Purpose of this guide is to help you understand the high level concepts in SCA so that you can build a simple application. For more details on SCA please refer to the various specifications available at www.osoa.org.
- What is SCA?
- SCA Component Implementation
- SCA Component
- SCA Composite
- SCA Domain
- What is a contribution?
- section x
- section y
What is SCA?
SCA is an executable model for assembly of services into business solutions. It simplifies component programming model for implementation of business services that can be implemented in any language. The key benefits of SCA are:
- Loose Coupling: Components integrate with other components without needing to know how other components are implemented. Components can be easily invoked either synchronously or asynchronously.
- Flexibility: Components can easily be replaced by other components. It also provides the flexibility to create solutions using existing services (bottom up) or model the business and develope the solution (top down).
- Productivity: It enables you to focus on your business logic rather than be slowed with concerns about infrastructure. SCA simplifies development experience for all developers (including J2EE and Integration Developers), integrators and application deployers
Now let's get into description of SCA building blocks.
SCA Component Implementation
The basic building block for SCA is a component implementation. When you're writing code for SCA, you are typically writing code that will either be the implementation of a component or will be used by such an implementation. A component implementation is described by the following attributes:
- Services: This describes the function this type of component provides
- References: This describes the dependencies this type of component has in order to function
- Properties: This defines configuration parameters that can controls how the program logic can behave. For example, what currency to use.
- Intent policies: This describes assumptions on how the component will behave. There are two types of policies.
- Implementation policy- Impact the behavior of an implementation. For example, transaction, monitor and logging
- Interaction policy - defines how the components behave with one another. For example, security.
A typical component implementation can be illustrated as:
The implementation of a component can be in any language that is suitable for the user, for example BPEL for business processes or XSL-T for transformations or Ruby for scripting or pure Java. How the services, references, properties and intents are defined for an implementation is specific to that particular implementation type.
SCA Component Implementation
A component is an instance of a configured component implementation. More than one component can use the same implementation. A component lives in a composite that is described next.
SCA Composite
Individual components like those above can be used on their own, or they can be grouped together in a composite. A composite is a type of component whose implementation is not code but an aggregation of one or more components co-operating to provide Services as a whole. Think of composite as a solution, for example credit check composite. A composite can also be used within a larger solution, for example credit check can be part of a order processing composite. A composite has the same charactersitics as a component. It provides Services, has References to other dependencies, and can be configured using Properties and can have intent policies in just the same way as an individual components can. In the example below, you see a calculator composite which consists of 5 components, a calculator service has references to four components:Add, Subtract, Multiply and Divide.
The assembly or wiring is defined in .composite file through Service Component Definition Language (SCDL). For example, calculator.composite would define that calculator component references the other four components.
SCA Domain
The implementations of components, either individual or composite, all form reusable units that can be run multiple times in different environments (in much the same way as you have multiple instances of a Java class). A composite, with its configuration information, gets packaged into a deployable unit called a contribution which gets contributed to the domain. Artifacts may be shared between contributions, for example Java classes, XSD files, WSDL files,etc.
An SCA Domain represents a complete runtime configuration, potentially distributed over a
series of interconnected runtime nodes. Domain configuration is the overall configuration for service dependencies, properties, policies. A domain is a logical view of the running applications or a coherent grouping of components that are working together, connected to each other using SCA wiring. A composite gets instantiated when it is actually used in an SCA environment.
SCA Domains can vary in size from the very small to the very large:
- a very small domain could be one within a test environment inside an IDE
- a medium sized domain could be a single server or small cluster supporting a single application
- a large domain could describe all the services within a department or company
In a large domain there may be all sorts of policies about where components can run and how they connect to each other or to external services. However, during development one is not concerned with all this. The code is packaged and made available for deployment. Tuscany SCA Java supports contributions in the form of JAR or filesystem.
Below is an example of domain with two contributions.