concept component definition in category system administration

This is an excerpt from Manning's book Tuscany SCA in Action.
The important thing to notice here is the two SCA @Reference annotations. They identify the mytrips and cart variables as holding references to other SCA services. SCA requires these variable names to match the reference names of the component definition in the composite file. You’ll see that there’s no code to initialize the contents of these variables. This is because the Tuscany SCA runtime initializes them by injecting proxies for the services that were configured as wire targets for these references in the component definition.
The SCA approach to components is different from other component technologies such as EJB, Microsoft .NET, and Spring. In SCA, any container-specific dependencies are encapsulated in the implementation type instead of being part of the component definitions. This is illustrated in figure 2.2.
Figure 2.2. SCA component definitions aren’t tied to any specific container technology, unlike components defined by other technologies such as EJB and Spring.
![]()
In the rest of this section we’ll look at the different implementation types that you can use with SCA components, and we’ll show how SCA uses component definitions to configure component implementations. We’ll also take a detailed look at the SCA concept of component type, which defines the formal relationship between a component implementation and its component definition.
The component definition can specify configuration settings for services defined in the implementation’s component type. For example, the component definition can change a service interface to use a different interface language. The Bookings service that you saw in section 2.2.1 has an introspected interface type of interface.java. The interface type could be changed to interface.wsdl in a component definition, which means that the component service interface is a WSDL 1.1 portType. This could be useful when creating a component that will be accessed by other components that don’t have Java implementations. Here’s an example component definition that does this:
<component name="WebBooking">
<implementation.java
class="com.tuscanyscatours.usingsca.impl.TripBookingImpl" />
<service name="Bookings">
<interface.wsdl interface=
"http://tuscanyscatours.com/#wsdl.interface(Bookings)" />
</service>
</component>Another example of component service configuration is a component definition overriding the component implementation’s service interfaces to subset the service operations defined by the component implementation. The component definition can’t add additional operations or additional services that go beyond those defined by the component implementation.
A component definition can’t remove any of the services defined by its component implementation. We’ll show how you can subset these services in section 3.4.2.
If the component definition doesn’t specify any configuration for the service, the default configuration computed by the component type discovery rules is used. For example, the same implementation could be used in another component defined as follows:
In SCA, a component is a configured implementation. The same implementation can be used in different components, configured in different ways. This enables code reuse while providing a high degree of flexibility and customizability. The configuration applied to an implementation that makes it into an SCA component is called a component definition.
SCA component definitions are written using an XML syntax. These definitions can configure those aspects of the component implementation that the implementation has exposed as being configurable. The configurable aspects of an implementation are collectively known as the implementation’s component type. The component type includes the services, references, and SCA properties defined by the implementation. The implementation’s business logic can’t be modified using component definitions, so the business logic isn’t part of the component type.