Business services: Top-down development

When using the top-down development approach to build an assembly diagram, you define the components for your application and then implement them.

Top-down development is used for creating new applications. For this type of development, you first model the application in the assembly diagram by creating components for the required services. Then, you define interfaces to access each service and add them to each component. Finally, based on the service calling requirements, you wire the components together. When the wiring is completed, you generate the SCA implementations from the components in the assembly diagram. The implementations (such as business processes, state machines, and so forth) provide the required services (business logic) for your application

Top-down StockPortfolio example

To illustrate the concepts covered in this topic, we will use a simple example of building a brand new customer stock portfolio query application that accesses several new services to retrieve information. The application accepts a customer ID and returns the customer's portfolio information. The application does not use any existing services so we will need to develop implementations for all the services.

Three services are required:

  • Service to retrieve the portfolio information for a customer by invoking two other services
  • Service to access the customer's account information
  • Service to find out the current stock price

We will also need to allow a JavaServer Pages (non-SCA ) application to invoke the query.

The following picture shows this application:

To simplify our discussion, we will create a single module for the application. All the new services will be added to this module.

Top-down development steps

This topic provides some general instructions on how you can use the assembly editor to build the integrated application. Detailed step-by-step instructions on how to use tools will not be covered but they are available from the related information at the end of this topic.

Here are the steps:

  1. Create a module

    Create a module, StockPortfolio, for the new application. We will assemble services and build the integrated application in its module assembly. All service implementations and resources will be created in the module.

  2. Edit the module assembly

    Open the StockPortfolio module assembly with the assembly editor and start to model the integrated application.

  3. Create components

    Using the assembly editor, we will first create the components that will provide the required services for our application.
    1. From the palette, select the Component with no implementation type and drop it onto the canvas. Edit the name of the component to change it to "CustomerQuery".
    2. Repeat the last step twice to create two other components, one with the component name CustomerInfo and the other, StockQuote.

    Here is an example of the StockPortfolio assembly diagram with the three new components:

    StockPortfolio module with the three components created in its module assembly

    Note: If we know the type of implementation that will be used for the component (for example, a human task component), we can select that type of component from the palette instead of the "no implementation" component. If, later, we change our minds, we can use the Change Type action to change the implementation type; see "Working with implementations" under related tasks for instructions on how to do this.
  4. Add interfaces to components

    Next, we are going to create the interface for each component. Interfaces define the operations and input/output that are used to invoke a service.
    1. Invoke the interface editor to create a new interface. In the Business Integration view, right-click to select New... > Interface. Create a new interface, CustomerQueryInterface, and add its operations with input and output.
    2. Select CustomerQuery component in the assembly diagram and click the Add Interface icon, Add Interface button. Select CustomerQueryInterface and add it to the component.

      There is also a simpler method to launch the interface editor from the assembly editor and add new interfaces to the components:

      For example, select the CustomerQuery component in the assembly diagram and click the Add Interface icon, Add Interface button. In the Add Interface window that is opened, click New... to launch the Interface editor so that we can create the interface. Once the new interface is created, we can finish adding it to the component.

      However, with this second method, the operations and input/output are not yet defined in the new interface. Later, we have to open the interface (with the interface editor) and add its operations and input/output before generating the implementation for the component. (We do not need the operations and input/output to wire components.)

    3. Repeat the previous step to create and add the interfaces to the CustomerInfo and StockQuote components.

    The interfaces have been added to the components in the following assembly diagram:

  5. Wire components

    We are ready to wire the components. Wiring is done from the source to the target.
    1. In the assembly editor, hover the mouse over the CustomerQuery component and an orange box with a handle appears around the component. Drag the handle to the CustomerInfo component to wire them together. Matching reference for CustomerInfoInterface will be created on CustomerQuery.
    2. Repeat the previous step to wire CustomerQuery to StockQuote.

    All the components are wired in the following assembly diagram:

    Wired components in the assembly diagram.

  6. Create component implementations

    We need to decide the type of implementation for each component before generating the implementations. Also, the wiring and definitions for all the interfaces should be completed before this step. Select each component and right-click to select Generate Implementation and the required implementation type. The implementation is created and opened in the editor for authoring.

    The following assembly diagram shows the three components with generated implementations:

    All three components have implementations

  7. Add stand-alone references

    To allow the JSP, which is not an SCA application, to invoke the CustomerQuery service, we will need to create a stand-alone references.

    The following assembly diagram has the stand-alone references:

    assembly diagram

    To understand how to package the JSP with the module and write the JSP code, read "Best practices: Modules and packaging for business services" under related reference.

We have finished using the top-down approach to build the new application. If any one of the components in the assembly diagram has to be used outside of the module, then create an export for the component's interface. Here, we have added an export for CustomerQuery component:

assembly diagram with an export for the CustomerQuery component

Also, if you want the service implementations to be in separate modules, you will need to add more steps, for example, to:
  • Create more modules
  • Create a library and add dependencies on the library to share resources such as business objects and interfaces
  • Create exports of services so that they can be used in other modules.
There are several samples that demonstrate top-down application development. For sample details see the related information at the end of this topic.
Related concepts
Business services: Components and modules
Business services: Bottom-up development
Business services: Meet-in-the-middle development
Quality of service: Qualifiers for business services
Business services: Using Java
Modules and libraries dependencies
Related tasks
Creating a module
Business services: Opening a module assembly
Business services: Working with implementations
Business services: Adding and wiring components
Business services: Generating bindings for imports and exports
Synchronizing the interfaces and references between components and implementations
Calling Java interfaces from WSDL references
Calling WSDL interfaces from Java references
Related reference
Best practices: Modules and packaging for business services

Related information

Tutorial: Wire components using the assembly editor
Samples: Assembly editor for business services

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.