cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Diephouse <...@envoisolutions.com>
Subject Re: Configuration APIs
Date Tue, 29 Aug 2006 17:11:47 GMT
Andrea Smyth wrote:

> So assuming all configurable properties of the http client and server 
> transport are data members of HTTPConduit.java and 
> JettyHTTPDestination with corresponding getters/setters (whether 
> manually coded or inherited from a generated POJO, also assume 
> standard getters for now) - how can we use Spring (for example) to run 
> the ClientServerTest in the systest module with a non-default value 
> for the contextMatchStrategy field (picking this one as it's of type 
> String) - without changing the test code? Any other properties of the 
> transport and other objects (e.g. bus) should be left at their defaults.
>
> We'll have something like:
>
> <bean id="?" class="org.apache.cxf.transport.http.JettyHTTPDestination">
>    <property name="contextMatchStrategy" value="stem"/>
> </bean>
>
> But do we need other beans that reference this one? How should the 
> id(s) be chosen?
> And what's the role of HTTPConduitFactory in this - is it not used at 
> all or is it used as a factory in the above bean definition? Same 
> question for the BusFactory.
>
> Dan D. - it would help if you could sketch out the steps involved - or 
> point to code for similar in XFire.
>
> Andrea.

Hi Andrea,

Sorry if I was being too vague.

Lets start off with our baseline spring definitions (these would be 
defined in an xml somewhere
<bean id="httpTransport">
  <property name="serverPolicy" ref="servicePolicy"/>
</bean>

<bean id="serverPolicy" class="...HttpServerPolicy"/>

<bean id="bus" class="org.apache.cxf.bus.CXFBus">
  <constructor-arg>
   <map>
    <entry key="org.apache.cxf.transport.DestinationFactoryManager" 
value-ref="destinationFactorymanager"/>
...
   </map>
  </constructor-arg>
</bean>

<bean id="destinationFactoryManager" 
class="org.apache.cxf.transport.DestinationFactoryManagerImpl">
  <property name="transports">
   <list>
     <entry ref="httpTransport">
...
   </list>
  </property>
</bean>

Now if we have a spring user all they need to override the policy is:

<import resource="/org/apache/cxf/spring/beans.xml"/>

<bean id="serverPolicy" class="...HttpServerPolicy">
.. override the defaults here.
</bean>

Similarily they could define their own list of transports. Or we could 
even help them by creating an abstract destination factory manager which 
they can extend.

The abstract one:
<bean id="abstractDestinationFactoryManager" 
class="org.apache.cxf.transport.DestinationFactoryManagerImpl" 
abstract="true">
  <property name="transports">
   <list>
     <entry ref="httpTransport">
...
   </list>
  </property>
</bean>

The user's:
<bean id="destinationFactoryManager" 
extends="abstractDestinationFactoryManager">
  <property name="transports">
    <list merge="true">
      <entry ref="myTransport">
   </list>
  </property>
</bean>

So in summary, the user only modifies what they want and the policies, 
transports, bus, are all handled by Spring. Also, the bean names don't 
really matter. If a user wants to override a bean in our beans.xml, the 
will need to know that name, but it doesn't really matter what it is.

 - Dan

-- 
Dan Diephouse
(616) 971-2053
Envoi Solutions LLC
http://netzooid.com


Mime
View raw message