Bean component configuration
kcbabo Feb 21, 2011 11:45 AMHere's what I have for a switchyard config in my M1 test application:
<switchyard xmlns="http://www.switchyard.org/config/model/switchyard/v1" targetNamespace="org.example.m1/m1-dry-run-0.0.1-SNAPSHOT" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard:soap-binding:1.0" name="m1app"> <sca:composite> <sca:service name="SimpleService" promote="SimpleService"> <soap:binding.soap> <soap:serverPort>18001</soap:serverPort> <soap:wsdl>wsdl/SimpleService.wsdl</soap:wsdl> </soap:binding.soap> </sca:service> <sca:component name="SimpleService"> <sca:implementation.bean class="org.switchyard.example.deployable.SimpleServiceBean" /> <sca:service name="SimpleService"> <sca:interface.java interface="org.switchyard.example.deployable.SimpleService" /> </sca:service> <sca:reference name="AnotherService"> <sca:interface.java interface="org.switchyard.example.deployable.AnotherService" /> </sca:reference> </sca:component> <sca:component name="AnotherService"> <sca:implementation.bean class="org.switchyard.example.deployable.AnotherServiceBean" /> <sca:service name="AnotherService"> <sca:interface.java interface="org.switchyard.example.deployable.AnotherService" /> </sca:service> </sca:component> </sca:composite> </switchyard>
We need a bean component scanner that integrates with the configuration plugin to produce the following parts of the above definition from @Service and @Reference annotations. Note that we also need a bean marshaller, model implementation, and XSD for the "bean" namespace.
<sca:component name="SimpleService"> <bean:implementation.bean class="org.switchyard.example.deployable.SimpleServiceBean" /> <sca:service name="SimpleService"> <sca:interface.java interface="org.switchyard.example.deployable.SimpleService" /> </sca:service> <sca:reference name="AnotherService"> <sca:interface.java interface="org.switchyard.example.deployable.AnotherService" /> </sca:reference> </sca:component> <sca:component name="AnotherService"> <bean:implementation.bean class="org.switchyard.example.deployable.AnotherServiceBean" /> <sca:service name="AnotherService"> <sca:interface.java interface="org.switchyard.example.deployable.AnotherService" /> </sca:service> </sca:component>