...
The use of the SCA programming model allows the BigBank developer to decouple the process of designing and creating the scenario from infrastructure concerns. In the BigBank composite, basic units of business logic are modelled as SCA components called AccountComponent, StockQuoteComponent and their business logic is implemented. Component references are wired to services. This relationship between component reference and services resolves to runtime proxies when the application is deployed. Where appropriate Tuscany SCA uses dependency injection to introduce proxies into each components reference.Once all business logic is implemented, appropriate bindings were are applied to references and services to indicate how the components should communicate.
so that they can collaborate. The XML SCA configuration language, called Service Component Description Language (SCDL), is used to describe the describes all of this information about loosely coupled enterprise component integration and the bindings to be used. Since binding information can be changed in the SCDL without changing the business logic, the implementation code is not polluted with protocol handling information and furthermore can be changed during deployment without impacting the application.
The following example shows the SCDL for defining the jsonrpc binding type. The binding can be changed to rmi by changing that line to shows the AccountService exposed using JSONRPC (binding.jsonrpc) and WebServices (binding.ws). The service can easily be made accessible over RMI by simply adding binding.rmi.
Code Block |
---|
<component name="AccountServiceComponent"> <implementation.java class="bigbank.account.AccountServiceImpl" /> <service name="AccountService"> <tuscany:binding.jsonrpc uri="/AccountJSONService" /> <binding.ws wsdlElement="http://bigbank#wsdl.port(AccountService/AccountServiceSoap)" /> <binding.sca /> </service> ... </component> |
Invoke other services using different protocols The following SCDL shows bindings applied to component references. Again these bindings can be changed or augmented without changing the business logic. Again this shows the separation between business logic and the network protocols to be used.
Code Block |
---|
<component name="AccountServiceComponent"> ... <reference name="calculatorService"> <tuscany:binding.rmi host="localhost" port="8099" serviceName="CalculatorRMIService" /> </reference> <reference name="stockQuoteService"> <binding.ws uri="http://localhost:8081/services/StockQuoteWebService" /> </reference> ... </component> |
...