Return-Path: Delivered-To: apmail-incubator-cxf-commits-archive@locus.apache.org Received: (qmail 17311 invoked from network); 16 Apr 2007 15:43:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Apr 2007 15:43:28 -0000 Received: (qmail 40961 invoked by uid 500); 16 Apr 2007 15:43:34 -0000 Delivered-To: apmail-incubator-cxf-commits-archive@incubator.apache.org Received: (qmail 40906 invoked by uid 500); 16 Apr 2007 15:43:33 -0000 Mailing-List: contact cxf-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-commits@incubator.apache.org Received: (qmail 40897 invoked by uid 99); 16 Apr 2007 15:43:33 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Apr 2007 08:43:33 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Apr 2007 08:43:25 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id AB81D1A9838; Mon, 16 Apr 2007 08:43:04 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r529292 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/endpoint/ api/src/main/java/org/apache/cxf/message/ rt/bindings/http/ rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ rt/core/src/main/java/org/apache/cxf/e... Date: Mon, 16 Apr 2007 15:42:56 -0000 To: cxf-commits@incubator.apache.org From: eglynn@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070416154304.AB81D1A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: eglynn Date: Mon Apr 16 08:42:53 2007 New Revision: 529292 URL: http://svn.apache.org/viewvc?view=rev&rev=529292 Log: Support for configurable conduit selection strategy Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java (with props) incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java (with props) incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java (with props) incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java (with props) incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java (with props) incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java (with props) Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java incubator/cxf/trunk/rt/bindings/http/pom.xml incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientFactoryBean.java incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ClientProxyFactoryBean.java incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/MAPAggregatorTest.java incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AbstractPolicyInterceptor.java incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyInterceptorsTest.java incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMManagerTest.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/addressing/wsa_interceptors.xml incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java?view=auto&rev=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java (added) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java Mon Apr 16 08:42:53 2007 @@ -0,0 +1,111 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.endpoint; + +import java.io.IOException; +import java.util.logging.Logger; + +import org.apache.cxf.Bus; +import org.apache.cxf.BusException; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; +import org.apache.cxf.service.model.EndpointInfo; +import org.apache.cxf.transport.Conduit; +import org.apache.cxf.transport.ConduitInitiator; +import org.apache.cxf.transport.ConduitInitiatorManager; +import org.apache.cxf.transport.MessageObserver; + + +/** + * Abstract base class holding logic common to any ConduitSelector + * that retreives a Conduit from the ConduitInitiator. + */ +public abstract class AbstractConduitSelector implements ConduitSelector { + + private Conduit selectedConduit; + + /** + * Constructor, allowing a specific conduit to override normal selection. + * + * @param c specific conduit + */ + public AbstractConduitSelector(Conduit c) { + selectedConduit = c; + } + + /** + * Mechanics to actually get the Conduit from the ConduitInitiator + * if necessary. + * + * @param message the current Message + */ + protected Conduit getSelectedConduit(Message message) { + if (selectedConduit == null) { + Exchange exchange = message.getExchange(); + Endpoint endpoint = exchange.get(Endpoint.class); + EndpointInfo ei = endpoint.getEndpointInfo(); + String transportID = ei.getTransportId(); + try { + ConduitInitiatorManager conduitInitiatorMgr = + getBus(exchange).getExtension(ConduitInitiatorManager.class); + if (conduitInitiatorMgr != null) { + ConduitInitiator conduitInitiator = + conduitInitiatorMgr.getConduitInitiator(transportID); + if (conduitInitiator != null) { + selectedConduit = conduitInitiator.getConduit(ei); + MessageObserver observer = + exchange.get(MessageObserver.class); + if (observer != null) { + selectedConduit.setMessageObserver(observer); + } else { + getLogger().warning("MessageObserver not found"); + } + } else { + getLogger().warning("ConduitInitiator not found: " + + ei.getAddress()); + } + } else { + getLogger().warning("ConduitInitiatorManager not found"); + } + } catch (BusException ex) { + throw new Fault(ex); + } catch (IOException ex) { + throw new Fault(ex); + } + } + return selectedConduit; + } + + /** + * Get the associated Bus instance from the exchange. + * + * @param exchange the current exchange + * @return the Bus instance + */ + private Bus getBus(Exchange exchange) { + return exchange.get(Bus.class); + } + + /** + * @return the logger to use + */ + protected abstract Logger getLogger(); +} Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java (original) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Client.java Mon Apr 16 08:42:53 2007 @@ -78,4 +78,18 @@ * @return Conduit */ Conduit getConduit(); + + /** + * Get the ConduitSelector responsible for retreiving the Conduit. + * + * @return the current ConduitSelector + */ + ConduitSelector getConduitSelector(); + + /** + * Set the ConduitSelector responsible for retreiving the Conduit. + * + * @param selector the ConduitSelector to use + */ + void setConduitSelector(ConduitSelector selector); } Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java?view=auto&rev=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java (added) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java Mon Apr 16 08:42:53 2007 @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.endpoint; + +import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; +import org.apache.cxf.transport.Conduit; + + +/** + * Strategy for retreival of a Conduit to mediate an outbound message. + * A specific instance implementing a particular strategy may be injected + * into the Client via config. + */ +public interface ConduitSelector { + + /** + * Called prior to the interceptor chain being traversed. + * This is the point at which an eager strategy would retrieve + * a Conduit. + * + * @param message the current Message + */ + void prepare(Message message); + + /** + * Called when a Conduit is actually required. + * This is the point at which a lazy strategy would retrieve + * a Conduit. + * + * @param message + * @return the Conduit to use for mediation of the message + */ + Conduit selectConduit(Message message); + + /** + * Called on completion of the MEP for which the Conduit was required. + * This is the point at which a one-shot strategy would dispose of + * the Conduit. + * + * @param exchange represents the completed MEP + */ + void complete(Exchange exchange); +} Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java?view=auto&rev=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java (added) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java Mon Apr 16 08:42:53 2007 @@ -0,0 +1,72 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.endpoint; + +import java.util.logging.Logger; + +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; +import org.apache.cxf.transport.Conduit; + +/** + * Strategy for lazy deferred retreival of a Conduit to mediate an + * outbound message. + */ +public class DeferredConduitSelector extends AbstractConduitSelector { + + private static final Logger LOG = + LogUtils.getL7dLogger(DeferredConduitSelector.class); + + /** + * Normal constructor. + */ + public DeferredConduitSelector() { + this(null); + } + + /** + * Constructor, allowing a specific conduit to override normal selection. + * + * @param c specific conduit + */ + public DeferredConduitSelector(Conduit c) { + super(c); + } + + public void prepare(Message message) { + // nothing to do + } + + public Conduit selectConduit(Message message) { + return getSelectedConduit(message); + } + + public void complete(Exchange exchange) { + // nothing to do + } + + /** + * @return the logger to use + */ + protected Logger getLogger() { + return LOG; + } +} Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/DeferredConduitSelector.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java?view=auto&rev=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java (added) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java Mon Apr 16 08:42:53 2007 @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.endpoint; + +import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; +import org.apache.cxf.transport.Conduit; + +/** + * Strategy for null Conduit retrieval. + * An instance of this class is set on the Exchange to clear + * the current ConduitSelector, as a work-around for broken + * Exchange.remove(ConduitSelector.class) semantics. + */ +public class NullConduitSelector implements ConduitSelector { + + public void prepare(Message message) { + // nothing to do + } + + public Conduit selectConduit(Message message) { + return null; + } + + public void complete(Exchange exchange) { + // nothing to do + } +} Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/NullConduitSelector.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java?view=auto&rev=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java (added) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java Mon Apr 16 08:42:53 2007 @@ -0,0 +1,77 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.endpoint; + +import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; +import org.apache.cxf.transport.Conduit; +import org.apache.cxf.transport.MessageObserver; + + +/** + * Strategy for retreival of a pre-existing Conduit to mediate an + * outbound message. + */ +public class PreexistingConduitSelector implements + ConduitSelector { + + private Conduit selectedConduit; + + /** + * Constructor. + * + * @param c the pre-existing Conduit. + */ + public PreexistingConduitSelector(Conduit c) { + selectedConduit = c; + } + + /** + * Called prior to the interceptor chain being traversed. + * + * @param message the current Message + */ + public void prepare(Message message) { + MessageObserver observer = + message.getExchange().get(MessageObserver.class); + if (observer != null) { + selectedConduit.setMessageObserver(observer); + } + } + + /** + * Called when a Conduit is actually required. + * + * @param message + * @return the Conduit to use for mediation of the message + */ + public Conduit selectConduit(Message message) { + return selectedConduit; + } + + /** + * Called on completion of the MEP for which the Conduit was required. + * + * @param exchange represents the completed MEP + */ + public void complete(Exchange exchange) { + // nothing to do + } +} Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java?view=auto&rev=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java (added) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java Mon Apr 16 08:42:53 2007 @@ -0,0 +1,90 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cxf.endpoint; + +import java.util.logging.Logger; + +//import org.apache.cxf.Bus; +import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.message.Exchange; +import org.apache.cxf.message.Message; +import org.apache.cxf.transport.Conduit; + + +/** + * Strategy for eager upfront retreival of a Conduit to mediate an + * outbound message. + */ +public class UpfrontConduitSelector extends AbstractConduitSelector { + + private static final Logger LOG = + LogUtils.getL7dLogger(UpfrontConduitSelector.class); + + /** + * Normal constructor. + */ + public UpfrontConduitSelector() { + this(null); + } + + /** + * Constructor, allowing a specific conduit to override normal selection. + * + * @param c specific conduit + */ + public UpfrontConduitSelector(Conduit c) { + super(c); + } + + /** + * Called prior to the interceptor chain being traversed. + * + * @param message the current Message + */ + public void prepare(Message message) { + getSelectedConduit(message); + } + + /** + * Called when a Conduit is actually required. + * + * @param message + * @return the Conduit to use for mediation of the message + */ + public Conduit selectConduit(Message message) { + return getSelectedConduit(message); + } + + /** + * Called on completion of the MEP for which the Conduit was required. + * + * @param exchange represents the completed MEP + */ + public void complete(Exchange exchange) { + // nothing to do + } + + /** + * @return the logger to use + */ + protected Logger getLogger() { + return LOG; + } +} Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/UpfrontConduitSelector.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java (original) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/AbstractWrappedMessage.java Mon Apr 16 08:42:53 2007 @@ -24,7 +24,6 @@ import java.util.Set; import org.apache.cxf.interceptor.InterceptorChain; -import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.Destination; /** @@ -78,10 +77,6 @@ public void setMessage(Message message) { this.message = message; - } - - public Conduit getConduit() { - return message.getConduit(); } public Destination getDestination() { Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java (original) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Exchange.java Mon Apr 16 08:42:53 2007 @@ -49,9 +49,10 @@ void setDestination(Destination destination); /** + * @param message the associated message * @return the associated outgoing Conduit (may be anonymous) */ - Conduit getConduit(); + Conduit getConduit(Message message); /** * @param conduit the associated outgoing Conduit Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java (original) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/ExchangeImpl.java Mon Apr 16 08:42:53 2007 @@ -19,6 +19,8 @@ package org.apache.cxf.message; +import org.apache.cxf.endpoint.ConduitSelector; +import org.apache.cxf.endpoint.PreexistingConduitSelector; import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.Destination; import org.apache.cxf.transport.Session; @@ -26,7 +28,6 @@ public class ExchangeImpl extends StringMapImpl implements Exchange { private Destination destination; - private Conduit conduit; private boolean oneWay; private Message inMessage; @@ -44,8 +45,10 @@ return inMessage; } - public Conduit getConduit() { - return conduit; + public Conduit getConduit(Message message) { + return get(ConduitSelector.class) != null + ? get(ConduitSelector.class).selectConduit(message) + : null; } public Message getOutMessage() { @@ -82,7 +85,7 @@ } public void setConduit(Conduit c) { - conduit = c; + put(ConduitSelector.class, new PreexistingConduitSelector(c)); } public void setOutMessage(Message m) { Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java (original) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/Message.java Mon Apr 16 08:42:53 2007 @@ -23,7 +23,6 @@ import java.util.Set; import org.apache.cxf.interceptor.InterceptorChain; -import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.Destination; public interface Message extends StringMap { @@ -68,11 +67,6 @@ InterceptorChain getInterceptorChain(); void setInterceptorChain(InterceptorChain chain); - - /** - * @return the associated Conduit if message is outbound, null otherwise - */ - Conduit getConduit(); /** * @return the associated Destination if message is inbound, null otherwise Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original) +++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java Mon Apr 16 08:42:53 2007 @@ -28,12 +28,10 @@ import org.apache.cxf.interceptor.InterceptorChain; import org.apache.cxf.service.Service; import org.apache.cxf.service.model.OperationInfo; -import org.apache.cxf.transport.Conduit; import org.apache.cxf.transport.Destination; public class MessageImpl extends StringMapImpl implements Message { private Collection attachments; - private Conduit conduit; private Destination destination; private Exchange exchange; private String id; @@ -53,10 +51,6 @@ return null; } - public Conduit getConduit() { - return conduit; - } - public Destination getDestination() { return destination; } @@ -83,10 +77,6 @@ public Set> getContentFormats() { return contents.keySet(); - } - - public void setConduit(Conduit c) { - this.conduit = c; } public void setDestination(Destination d) { Modified: incubator/cxf/trunk/rt/bindings/http/pom.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/pom.xml?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/bindings/http/pom.xml (original) +++ incubator/cxf/trunk/rt/bindings/http/pom.xml Mon Apr 16 08:42:53 2007 @@ -34,7 +34,7 @@ org.codehaus.jra jra - 1.0-alpha-3 + 1.0-alpha-2 org.apache.cxf Modified: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java (original) +++ incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/LocalServerRegistrationTest.java Mon Apr 16 08:42:53 2007 @@ -79,7 +79,7 @@ ex.setInMessage(m); Conduit c = getLocalConduit("local://" + server); - m.setConduit(c); + ex.setConduit(c); c.setMessageObserver(new MessageObserver() { public void onMessage(Message message) { Modified: incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java (original) +++ incubator/cxf/trunk/rt/bindings/object/src/test/java/org/apache/cxf/binding/object/ObjectBindingTest.java Mon Apr 16 08:42:53 2007 @@ -77,7 +77,7 @@ ex.setInMessage(m); Conduit c = getLocalConduit("local://Echo"); - m.setConduit(c); + ex.setConduit(c); c.setMessageObserver(new MessageObserver() { public void onMessage(Message message) { Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Mon Apr 16 08:42:53 2007 @@ -19,7 +19,6 @@ package org.apache.cxf.endpoint; -import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.Collections; @@ -33,7 +32,6 @@ import com.ibm.wsdl.extensions.soap.SOAPBindingImpl; import org.apache.cxf.Bus; -import org.apache.cxf.BusException; import org.apache.cxf.BusFactory; import org.apache.cxf.binding.Binding; import org.apache.cxf.common.i18n.UncheckedException; @@ -41,12 +39,12 @@ import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider; import org.apache.cxf.interceptor.ClientOutFaultObserver; -import org.apache.cxf.interceptor.Fault; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.interceptor.InterceptorChain; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.ExchangeImpl; import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageImpl; import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.phase.PhaseManager; import org.apache.cxf.service.Service; @@ -59,8 +57,6 @@ import org.apache.cxf.service.model.OperationInfo; import org.apache.cxf.service.model.ServiceInfo; import org.apache.cxf.transport.Conduit; -import org.apache.cxf.transport.ConduitInitiator; -import org.apache.cxf.transport.ConduitInitiatorManager; import org.apache.cxf.transport.MessageObserver; import org.apache.cxf.wsdl11.WSDLServiceFactory; @@ -71,7 +67,7 @@ protected Bus bus; protected Endpoint endpoint; - protected Conduit initedConduit; + protected ConduitSelector conduitSelector; protected ClientOutFaultObserver outFaultObserver; protected int synchronousTimeout = 10000; // default 10 second timeout @@ -84,7 +80,7 @@ endpoint = e; outFaultObserver = new ClientOutFaultObserver(bus); if (null != c) { - initedConduit = c; + conduitSelector = new PreexistingConduitSelector(c); } } @@ -111,7 +107,6 @@ throw new IllegalStateException("Unable to create endpoint: " + epex.getMessage(), epex); } } - private EndpointInfo findEndpoint(Service svc, QName port) { EndpointInfo epfo; @@ -203,7 +198,7 @@ exchange.setOutMessage(message); setOutMessageProperties(message, oi); - setExchangeProperties(exchange, requestContext, oi); + setExchangeProperties(exchange, oi); // setup chain @@ -212,24 +207,15 @@ modifyChain(chain, requestContext); chain.setFaultObserver(outFaultObserver); - - if (requestContext != null - && requestContext.containsKey(Message.ENDPOINT_ADDRESS)) { - endpoint.getEndpointInfo().setAddress((String)requestContext.get(Message.ENDPOINT_ADDRESS)); - } - - - // setup conduit - Conduit conduit = getConduit(); - exchange.setConduit(conduit); - conduit.setMessageObserver(this); - - //set clientImpl to exchange. used by jax-ws handlers - exchange.put(Client.class, this); + + // setup conduit selector + prepareConduitSelector(message); // execute chain chain.doIntercept(message); + getConduitSelector().complete(exchange); + // Check to see if there is a Fault from the outgoing chain Exception ex = message.getContent(Exception.class); @@ -371,21 +357,17 @@ } } - public Conduit getConduit() { - if (null == initedConduit) { - EndpointInfo ei = endpoint.getEndpointInfo(); - String transportID = ei.getTransportId(); - try { - ConduitInitiator ci = bus.getExtension(ConduitInitiatorManager.class) - .getConduitInitiator(transportID); - initedConduit = ci.getConduit(ei); - } catch (BusException ex) { - throw new Fault(ex); - } catch (IOException ex) { - throw new Fault(ex); - } - } - return initedConduit; + public Conduit getConduit() { + Message message = new MessageImpl(); + Exchange exchange = new ExchangeImpl(); + message.setExchange(exchange); + setExchangeProperties(exchange, null); + return getConduitSelector().selectConduit(message); + } + + protected void prepareConduitSelector(Message message) { + getConduitSelector().prepare(message); + message.getExchange().put(ConduitSelector.class, getConduitSelector()); } protected void setOutMessageProperties(Message message, BindingOperationInfo boi) { @@ -396,17 +378,23 @@ } protected void setExchangeProperties(Exchange exchange, - Map ctx, BindingOperationInfo boi) { exchange.put(Service.class, endpoint.getService()); exchange.put(Endpoint.class, endpoint); - exchange.put(ServiceInfo.class, endpoint.getEndpointInfo().getService()); - exchange.put(InterfaceInfo.class, endpoint.getEndpointInfo().getService().getInterface()); + if (endpoint.getEndpointInfo().getService() != null) { + exchange.put(ServiceInfo.class, endpoint.getEndpointInfo().getService()); + exchange.put(InterfaceInfo.class, endpoint.getEndpointInfo().getService().getInterface()); + } exchange.put(Binding.class, endpoint.getBinding()); exchange.put(BindingInfo.class, endpoint.getEndpointInfo().getBinding()); - exchange.put(BindingOperationInfo.class, boi); - exchange.put(OperationInfo.class, boi.getOperationInfo()); + if (boi != null) { + exchange.put(BindingOperationInfo.class, boi); + exchange.put(OperationInfo.class, boi.getOperationInfo()); + } + + exchange.put(MessageObserver.class, this); + exchange.put(Bus.class, bus); } protected PhaseInterceptorChain setupInterceptorChain() { @@ -451,6 +439,17 @@ public void setSynchronousTimeout(int synchronousTimeout) { this.synchronousTimeout = synchronousTimeout; + } + + public synchronized ConduitSelector getConduitSelector() { + if (null == conduitSelector) { + conduitSelector = new UpfrontConduitSelector(); + } + return conduitSelector; + } + + public void setConduitSelector(ConduitSelector selector) { + conduitSelector = selector; } private boolean isPartialResponse(Message in) { Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/MessageSenderInterceptor.java Mon Apr 16 08:42:53 2007 @@ -41,19 +41,8 @@ } public void handleMessage(Message message) { - Exchange exchange = message.getExchange(); - Conduit conduit = - message.getConduit() != null - ? message.getConduit() - : exchange.getConduit() != null - ? exchange.getConduit() - : (exchange.getOutMessage() != null - || exchange.getOutFaultMessage() != null) - ? OutgoingChainInterceptor.getBackChannelConduit(exchange) - : null; - try { - conduit.prepare(message); + getConduit(message).prepare(message); } catch (IOException ex) { throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_SEND", BUNDLE), ex); } @@ -69,18 +58,23 @@ } public void handleMessage(Message message) throws Fault { - Exchange ex = message.getExchange(); - Conduit endingConduit = - message.getConduit() != null - ? message.getConduit() : ex.getConduit() != null - ? ex.getConduit() : (ex.getOutMessage() != null || ex.getOutFaultMessage() != null) - ? OutgoingChainInterceptor.getBackChannelConduit(ex) : null; try { - endingConduit.close(message); + getConduit(message).close(message); } catch (IOException e) { throw new Fault(new org.apache.cxf.common.i18n.Message("COULD_NOT_SEND", BUNDLE), e); } } + } + + private Conduit getConduit(Message message) { + Exchange exchange = message.getExchange(); + Conduit conduit = exchange.getConduit(message); + if (conduit == null + && (exchange.getOutMessage() != null + || exchange.getOutFaultMessage() != null)) { + conduit = OutgoingChainInterceptor.getBackChannelConduit(message); + } + return conduit; } } Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OutgoingChainInterceptor.java Mon Apr 16 08:42:53 2007 @@ -26,7 +26,9 @@ import org.apache.cxf.Bus; import org.apache.cxf.binding.Binding; +import org.apache.cxf.endpoint.ConduitSelector; import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.endpoint.PreexistingConduitSelector; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; @@ -54,7 +56,7 @@ } Message out = ex.getOutMessage(); if (out != null) { - getBackChannelConduit(ex); + getBackChannelConduit(message); if (bin != null) { out.put(MessageInfo.class, bin.getOperationInfo().getOutput()); out.put(BindingMessageInfo.class, bin.getOutput()); @@ -69,15 +71,17 @@ } } - protected static Conduit getBackChannelConduit(Exchange ex) { + protected static Conduit getBackChannelConduit(Message message) { Conduit conduit = null; - if (ex.getConduit() == null + Exchange ex = message.getExchange(); + if (ex.getConduit(message) == null && ex.getDestination() != null) { try { EndpointReferenceType target = ex.get(EndpointReferenceType.class); conduit = ex.getDestination().getBackChannel(ex.getInMessage(), null, target); - ex.setConduit(conduit); + ex.put(ConduitSelector.class, + new PreexistingConduitSelector(conduit)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java (original) +++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractConduit.java Mon Apr 16 08:42:53 2007 @@ -72,4 +72,13 @@ public void close() { // nothing to do by default } + + public String toString() { + return "conduit: " + this.getClass() + System.identityHashCode(this) + + "target: " + + ((getTarget() != null + && getTarget().getAddress() != null) + ? getTarget().getAddress().getValue() + : "null"); + } } Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Mon Apr 16 08:42:53 2007 @@ -19,7 +19,6 @@ package org.apache.cxf.jaxws; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -38,9 +37,10 @@ import javax.xml.ws.Service; import org.apache.cxf.Bus; -import org.apache.cxf.BusException; import org.apache.cxf.common.logging.LogUtils; +import org.apache.cxf.endpoint.ConduitSelector; import org.apache.cxf.endpoint.Endpoint; +import org.apache.cxf.endpoint.UpfrontConduitSelector; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.jaxws.interceptors.DispatchInInterceptor; import org.apache.cxf.jaxws.interceptors.DispatchOutInterceptor; @@ -51,10 +51,6 @@ import org.apache.cxf.message.Message; import org.apache.cxf.phase.PhaseInterceptorChain; import org.apache.cxf.phase.PhaseManager; -import org.apache.cxf.service.model.EndpointInfo; -import org.apache.cxf.transport.Conduit; -import org.apache.cxf.transport.ConduitInitiator; -import org.apache.cxf.transport.ConduitInitiatorManager; import org.apache.cxf.transport.MessageObserver; public class DispatchImpl extends BindingProviderImpl implements Dispatch, MessageObserver { @@ -68,7 +64,8 @@ private Service.Mode mode; private Endpoint endpoint; - + private ConduitSelector conduitSelector; + DispatchImpl(Bus b, Service.Mode m, Class clazz, Executor e, Endpoint ep) { super(((JaxWsEndpointImpl)ep).getJaxwsBinding()); bus = b; @@ -128,32 +125,29 @@ ContextPropertiesMapping.mapRequestfromJaxws2Cxf(message); Exchange exchange = new ExchangeImpl(); - exchange.put(Service.Mode.class, mode); - exchange.put(Class.class, cl); - exchange.put(org.apache.cxf.service.Service.class, endpoint.getService()); exchange.setOutMessage(message); - message.setExchange(exchange); + setExchangeProperties(exchange); message.setContent(Object.class, obj); PhaseInterceptorChain chain = getDispatchOutChain(); message.setInterceptorChain(chain); - // setup conduit - Conduit conduit = getConduit(); - exchange.setConduit(conduit); - conduit.setMessageObserver(this); - + // setup conduit selector + prepareConduitSelector(message); + // execute chain chain.doIntercept(message); + + getConduitSelector().complete(exchange); if (message.getContent(Exception.class) != null) { throw new RuntimeException(message.getContent(Exception.class)); } // correlate response - if (conduit.getBackChannel() != null) { + if (getConduitSelector().selectConduit(message).getBackChannel() != null) { // process partial response and wait for decoupled response } else { // process response: send was synchronous so when we get here we can assume that the @@ -248,24 +242,6 @@ } } - private Conduit getConduit() { - EndpointInfo ei = endpoint.getEndpointInfo(); - String transportID = ei.getTransportId(); - try { - ConduitInitiator ci = bus.getExtension(ConduitInitiatorManager.class) - .getConduitInitiator(transportID); - return ci.getConduit(ei); - } catch (BusException ex) { - // TODO: wrap in runtime exception - ex.printStackTrace(); - } catch (IOException ex) { - // TODO: wrap in runtime exception - ex.printStackTrace(); - } - - return null; - } - private Executor getExecutor() { if (executor == null) { executor = endpoint.getService().getExecutor(); @@ -297,4 +273,31 @@ public void invokeOneWay(T obj) { invoke(obj, true); } + + public synchronized ConduitSelector getConduitSelector() { + if (null == conduitSelector) { + conduitSelector = new UpfrontConduitSelector(); + } + return conduitSelector; + } + + public void setConduitSelector(ConduitSelector selector) { + conduitSelector = selector; + } + + protected void prepareConduitSelector(Message message) { + getConduitSelector().prepare(message); + message.getExchange().put(ConduitSelector.class, getConduitSelector()); + } + + protected void setExchangeProperties(Exchange exchange) { + exchange.put(Service.Mode.class, mode); + exchange.put(Class.class, cl); + exchange.put(org.apache.cxf.service.Service.class, endpoint.getService()); + exchange.put(Endpoint.class, endpoint); + + exchange.put(MessageObserver.class, this); + exchange.put(Bus.class, bus); + } + } Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptor.java Mon Apr 16 08:42:53 2007 @@ -24,11 +24,11 @@ import javax.xml.transform.Source; import javax.xml.ws.Binding; -import org.apache.cxf.endpoint.Client; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageImpl; import org.apache.cxf.phase.Phase; import org.apache.cxf.phase.PhaseInterceptorChain; +import org.apache.cxf.transport.MessageObserver; public class LogicalHandlerInterceptor extends AbstractJAXWSHandlerInterceptor { @@ -55,13 +55,12 @@ * 3. set XMLSTreamReader to element inside Body * OR * message.setContent(Element.class, elementInBody); - * 4. invoke Client.onMessage() starting after this.getID() + * 4. invoke MessageObserver.onMessage() starting after this.getID() */ - Client client = (Client)message.getExchange().get(Client.class); + MessageObserver observer = + (MessageObserver)message.getExchange().get(MessageObserver.class); responseMsg.put(PhaseInterceptorChain.STARTING_AFTER_INTERCEPTOR_ID, this.getId()); - if (client != null) { - //message.getExchange().put(ClientImpl.FINISHED, Boolean.TRUE); - //lctx.getMessage().getPayload(); + if (observer != null) { Source inSource = message.getContent(Source.class); if (inSource != null) { responseMsg.setContent(Source.class, inSource); @@ -70,7 +69,7 @@ if (inObj != null) { responseMsg.setContent(List.class, inObj); } - client.onMessage(responseMsg); + observer.onMessage(responseMsg); } else if (!message.getExchange().isOneWay()) { //for the server side inbound Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/resources/org/apache/cxf/jaxws/spring/jaxws.xsd Mon Apr 16 08:42:53 2007 @@ -78,6 +78,7 @@ + Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/handler/LogicalHandlerInterceptorTest.java Mon Apr 16 08:42:53 2007 @@ -30,11 +30,11 @@ import javax.xml.ws.handler.MessageContext; import junit.framework.TestCase; -import org.apache.cxf.endpoint.Client; import org.apache.cxf.interceptor.InterceptorChain; import org.apache.cxf.message.Exchange; import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageImpl; +import org.apache.cxf.transport.MessageObserver; import org.apache.handlers.types.AddNumbersResponse; import org.easymock.EasyMock; import org.easymock.classextension.IMocksControl; @@ -124,9 +124,9 @@ outMessage.setInterceptorChain(chain); chain.abort(); EasyMock.expectLastCall(); - Client client = control1.createMock(Client.class); - expect(exchange1.get(Client.class)).andReturn(client).anyTimes(); - client.onMessage(isA(Message.class)); + MessageObserver observer = control1.createMock(MessageObserver.class); + expect(exchange1.get(MessageObserver.class)).andReturn(observer).anyTimes(); + observer.onMessage(isA(Message.class)); EasyMock.expectLastCall(); control1.replay(); Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/SpringBeansTest.java Mon Apr 16 08:42:53 2007 @@ -29,6 +29,9 @@ import org.apache.cxf.binding.soap.SoapBindingConfiguration; import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor; import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor; +import org.apache.cxf.endpoint.Client; +import org.apache.cxf.endpoint.NullConduitSelector; +import org.apache.cxf.frontend.ClientProxy; import org.apache.cxf.interceptor.Interceptor; import org.apache.cxf.interceptor.LoggingInInterceptor; import org.apache.cxf.interceptor.LoggingOutInterceptor; @@ -142,8 +145,12 @@ Object bean = ctx.getBean("client1.jaxwsProxyFactory"); assertNotNull(bean); - Greeter c1 = (Greeter) ctx.getBean("client1"); - assertNotNull(c1); - + Greeter greeter = (Greeter) ctx.getBean("client1"); + assertNotNull(greeter); + + Client client = ClientProxy.getClient(greeter); + assertNotNull("expected ConduitSelector", client.getConduitSelector()); + assertTrue("unexpected ConduitSelector", + client.getConduitSelector() instanceof NullConduitSelector); } } Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml (original) +++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/spring/clients.xml Mon Apr 16 08:42:53 2007 @@ -43,7 +43,11 @@ serviceClass="org.apache.hello_world_soap_http.Greeter" address="http://localhost:9000/foo" serviceName="s:SOAPService" - xmlns:s="http://apache.org/hello_world_soap_http"/> + xmlns:s="http://apache.org/hello_world_soap_http"> + + + + Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl?view=diff&rev=529292&r1=529291&r2=529292 ============================================================================== --- incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl (original) +++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/hello_world.wsdl Mon Apr 16 08:42:53 2007 @@ -392,7 +392,7 @@ - +