IBM Gift Center architecture

To allow for separation between the front-end user interface and back-end business logic, the IBM Gift Center is built on a layered architecture:

For Web performance and scalability purposes, data beans interact with access beans directly, as indicated with the arrow connecting the two in the diagram. This is consistent with the WebSphere Commerce architecture.

As illustrated, the IBM Gift Center architecture consists of four layers:

Commerce Web (presentation) layer

The Web or presentation layer includes JSP files and Struts actions, and is the layer that controls the display to the end user (that is, customers who create gift registries). The Struts actions convert name-value pairs (NVPs) passed by the Web application to the appropriate business object document (BOD), and delegates the actual business logic to the gift registry service.

Within the IBM Gift Center, a BOD is a business object that encapsulates a request to manipulate gift registries. BODs are passed to and from the IBM Gift Center service interface. A BOD can be considered a self-describing message; it describes the context in which a request will be completed, what data will be updated, and how the data will be updated. When creating and processing BODs, you should be familiar with the following concepts:

  • Application area (where communication information is passed)
  • Noun (the actual value object, containing the data to be processed)
  • Verb (contains a verb action to be performed on a noun)
  • Verb action (performed by the verb, and associated with paths). A verb action is associated with a path that locates a node. A verb action indicates what should be done to its associated path. For example, VerbAction.CANCEL means the node represented by the associated path should be canceled. A path is used to locate a node in the BOD, which can be an object or an object property, that needs to be manipulated. Since each node in a BOD has at most one parent node, a path can be constructed backwards (that is, you can construct a path to a node which starts right from the node). For example, GiftRegistryUtils.getVerbPath (registrant,null) returns the path that starts from the BOD DataArea, to the object registrant, assuming that the registrant is already added into the BOD.

    Preconditions

    A lookup of the path of a node requires that the node exists in the BOD. Each value object must have a parent that is also in the BOD.

    Methods to watch

    AbstractBusinessObjectDocument (getAction and getValue), and GiftRegistryUtils (getVerbPath).

    For example, the following path indicates that for a gift registry, there is a registrant, with an address, and a last name:

    getRegistry().getRegistrant().getAddress().getLastName();
    VerbAction.UPDATE
    

    The verb action associated with this is update (VerbAction.UPDATE) and you can use the following utility method to get the path to the last name for the gift registrant:

    GiftRegistryUtils.getVerbPath(address, "lastname")

A service interface is a Java interface class that defines all the support calls that can be made to a given component. In the service interface for the gift registry, every method accepts exactly one parameter, and returns one parameter. These parameters are called messages.

Component (business logic) layer

The component (or business logic) layer includes the core functionality for the IBM Gift Center. The GiftRegistryServiceBean is a single entry point for all communication. The bean is implemented as a stateless session bean, which you can extend to include new functionality. The component layer is composed of BOD commands; that is, every command from this layer extends from a BusinessObjectDocumentCmd command. This layer interacts with the Business Context Service and calls persistence BusinessObjectDocumentCmd commands to store data.

A BusinessObjectDocumentCmd (sometimes referred to as a BOD command) is an extension of a WebSphere Commerce task command. It supports the notion of a one message in, one message out service interface.

Business Context Service is a context engine that stores data to be called at a later time. There are several business contexts provided with WebSphere Commerce; for example, the globalization context and the entitlement context. If IBM Gift Center is enabled, the gift registry context will also be enabled, and stores access information for each gift registry user.

Data service layer

The data service layer is closely related to the component layer. The persistence BusinessObjectDocumentCmd commands can be viewed as part of the data service layer. The persistence commands take a BOD as input, and save it for later use, using access beans.

Persistence layer

The data persistence layer uses standard EJB bean and access bean technology.