You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Spring

(warning) the scenario details here are currently copied from unit tests. We should replace with the big bank scenario now that is being checked in.

Use implentation.composite as a component implementation - Implicit declaration

A Spring component acts within a business process accepting call from client components and send on calls to other components. The operation of the component in the Spring assembly is controlled through SCA properties.Here the component type is derived from the spring implementation with no SCA specific entries in the spring application context.

<beans xmlns=...>

    <bean id="testBean" class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldBean">
        <property name="bean" ref="testReference"/>
        <property name="hello" ref="testProperty"/>
    </bean>
</beans>

where the composite file is

    <component name="ClientComponent">
        <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldProxy"/>
        <reference name="delegate" target="SpringComponent"/>
    </component>

    <component name="SpringComponent">
        <implementation.spring location="META-INF/sca/SpringComponent-context.xml"/>
        <reference name="testReference" target="ReferenceComponent"/>
        <property name="testProperty">Hello</property>
    </component>

    <component name="ReferenceComponent">
        <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldImpl"/>
    </component>

Use implementation.composite as a component implementation - Explicit declaration

A Spring component acts within a business process accepting call from client components and send on calls to other components. The operation of the component in the Spring assembly is controlled through SCA properties. Here the component type is derived from the spring implementation with no SCA specific entries in the spring application context.

<beans xmlns=...>

    <sca:service name="testService" 
                 type="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorld" 
                 target="testBean"/>

    <bean id="testBean" class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldBean">
        <property name="bean" ref="testReference"/>
        <property name="hello" ref="testProperty"/>
    </bean>

    <sca:reference name="testReference" type="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorld"/>

    <sca:property id="foo" name="testProperty" type="java.lang.String"/>
</beans>

where the composite file is

    <component name="ClientComponent">
        <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldProxy"/>
        <reference name="delegate" target="SpringComponent"/>
    </component>

    <component name="SpringComponent">
        <implementation.spring location="META-INF/sca/SpringComponent-context.xml"/>
        <reference name="testReference" target="ReferenceComponent"/>
        <property name="testProperty">Hello</property>
    </component>

    <component name="ReferenceComponent">
        <implementation.java class="org.apache.tuscany.sca.implementation.spring.itests.helloworld.HelloWorldImpl"/>
    </component>

The SpringComponent successfully operates performs HelloWorld actions in the context of the configuration from the composite file.

Working with different bindings

The SpringComponent implementation remains the same but different bindings are chosen.

<component name="SpringComponent">
<implementation.spring location="META-INF/sca/SpringComponent-context.xml"/>
<service name="testService">
<binding.ws>
</service>
<reference name="testReference" target="ReferenceComponent">
<binding.ws/>
</reference>
<property name="TestProperty">Hello</property>
</component>

Or

<component name="SpringComponent">
<implementation.spring location="META-INF/sca/SpringComponent-context.xml"/>
<service name="testService">
<binding.jms>
</service>
<reference name="testReference" target="ReferenceComponent">
<binding.jms/>
</reference>
<property name="TestProperty">Hello</property>
</component>

Policy - Security

Policy - Transaction

  • No labels