Thanks for all the feedback. I'm sure the JAX RS Whiteboard is much cleaner.
I've got legacy code I'm dealing with and can only go so far. JBs code would
also be applicable to a JAXWSFactoryBean if I have to set up a related SOAP
service. I commonly annotate my interfaces with both SOAP and REST
annotations. The only thing they commonly share is some bus with bus ID -
either the default Bus or, more commonly, a Bus by ID that is shared across
some subset of the web services.

What I'm currently working on is a CXF Bus managed service factory that is
more like PAX JDBC but for CXF Busses. This service factory is listening for
PIDs starting with org.apache.cxf.bus-* which will trigger the update.

I'm going to create a plugin interface that takes the properties and Bus
interface and I can then configure things for JAASAuthentication, logging,
etc. 

@Override
public void updated(String pid, Dictionary<String, ?> properties) throws
ConfigurationException {


So this might be my logging plugin. Just a change in the cfg changes what is
logged (most organizations don't want production stuff logged but want to
log during dev and QA). This let's me keep the same bus ID but change the
logging.

Since I'm developing this for a specific business use case I don't have to
have plugin support of everything in the world. The Bus factory just has to
support the superset of features/providers/interceptors required  for the
instance and this let's me also keep it so that I can install 1...N services
in the container but not require any particular mix.


I can unit test these individual plugins with Mockito mocks of the Bus via
the plugin interface. Basically just checking that the properties are
resulting in correct configuration of interceptors. 

Just switching to code helps a lot. In Blueprint you don't see that these
interceptors are deprecated, for example.

        private final LoggingInInterceptor loggingIn = new
LoggingInInterceptor();
        private final LoggingOutInterceptor loggingOut = new
LoggingOutInterceptor();
        
        public void initBus(Bus bus, Dictionary<String, ?> properties) {
                Boolean logIn = (Boolean) properties.get("logIn");
                Boolean logOut=(Boolean) properties.get("logOut");
                Boolean errorLogIn =(Boolean) properties.get("errorLogIn");
                Boolean errorLogOut =(Boolean) properties.get("errorLogIn");
                if(logIn)
                        bus.getInInterceptors().add(loggingIn);
                if(logOut)
                        bus.getOutInterceptors().add(loggingOut);
                if(errorLogOut)
                        bus.getOutFaultInterceptors().add(loggingOut);
                if(errorLogIn)
                        bus.getInFaultInterceptors().add(loggingIn);
        }



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Reply via email to