I was wondering about the minimal amount of code required to write a nicely behaving JBI component with proper component, endpoint, deployer and URI/EPR handling etc.
e.g. if we were to refactor more of the components in the servicemix-components module into their own module like the jms, http and jsr181 modules - what new code would be required. Or rather how little could we get away with :) So I was wondering if we could do a little bit of refactoring to reduce the amount of code that is really needed to be written on each component. (Some of the other components are way simpler than jms, http and JSR181 support too such as the file component so the code should hopefully be even simpler). I've not had an coffee yet so please excuse any silly ideas but a quick run through the code in the Jms and HTTP components with brief looks at JSR181 led to the following thoughts... * HttpBootstrap & JmsBootstrap are pretty much identical apart from the configuration property (incidentally should HttpBootstrap use a HttpConfiguration like JmsBootstrap?) so am wondering if we can push more of its logic up to a base class - maybe allowing the configuration object to be specified as a constructor argument? * HttpLifecycle & JmsLifecycle have quite a few similarities. I wonder could we refactor most of the code into the *Configuration and *Endpoint classes so that we could basically share the same Lifecycle classes in most components? * Jms/HttpExternalEndpoint look pretty identical - just dependent on their Jms/HttpEndpoint classes * Jms/HttpResolvedEndpoint pretty much the same bar some constants - maybe moving those into the *Endpoint or *Component classes might make the code simpler? * Jms/HttpSpringComponent - look about the same apart from the use of Jms/HttpEndpoint - I wonder if generics could be used to share a common base class? Basically the only real difference is the type of the endpoint. * Jms/HttpXBeanDeployer - we could maybe use a generic XBeanDeployer which is parameterized on the type of the Endpoint and then call *Endpoint.validate() to avoid needing to write a new class for this unless its absolutely necessary (like it is for JSR181)? I was really just trying to avoid as much of the boiler plate code as possible so we could make more fully-JBI compliant components with as little code as possible. Am thinking the bare minimum would be something like the bootstrap, component, configuration & endpoint classes with reusable base classes for most of the other stuff then the consumer/producer classes for doing the actual work. Any other thoughts on how to reduce/simplify the amount of code required? -- James ------- http://radio.weblogs.com/0112098/