IBM WebSphere Adapters Network Card User Manual


 
Command Manager simplifies before and after comparisons
As shown in the upper portion of the figure, the input to the Command Manager
is a before image and an after image. The Command Manager creates a top-level
command representing the operation for the top-level incoming cursor. As
processing continues, sub-commands are added at the child object level and so on
to the top-level incoming cursor, as shown in the lower portion of the figure.
The Command Manager provides a first class support for Create, Retrieve, Update
and Delete operations using static variables defined in the WBIInteractionSpec
class:
WBIInteractionSpec.CREATE
WBIInteractionSpec.UPDATE
WBIInteractionSpec.DELETE
WBIInteractionSpec.RETRIEVE
You can use the Command Manager for other supported operations, too. It creates
a command pattern hierarchy with the same operation at all the levels in the in the
cursor hierarchy. Specifically, you would configure the CommandFactory for Object
type operations with isOOType() returning true.IfisOOType() returns false, the
Command Manager would create only one command in the command hierarchy
for the top-level cursor.
For other non-CRUD operations, it may not make sense to use the command
pattern capability. For example, if the operation supported is XXX, and if XXX
simply executes a function call at the top-level cursor only, there is no need to
apply the XXX operation to all child cursors.
As it begins to process children of the root object, the Command Manager iterates
through the properties for the top-level cursor. For each property which is of type
containment, the Command Manager attempts to construct a hashset of the key
values for each child. Every entity, root or child, must have a primary key, which is
how the Command Manager distinguishes records.
The Command Manager constructs two sets, A and B. Set A will be the set of
primary keys in the before-image child container. Set B is the set of primary keys
in the after-image container.
v The set A-B contains extra children. These will be Deleted.
v The set B-A contains missing children. These will be Created.
v The set A intersect B contains children to be updated. These will be updated.
For each record in each set for extra and missing children, the Command
Manager will recursively follow the child record and all its children, for each entity
adding to the top level command the child command representing the child cursor
and its corresponding operation.
For children to be updated, the before- and after-image data are passed back to the
Command Manager. This allows the Command Manager to recursively process any
children that those children might contain. When the Command Manager reaches
the bottom level of both structures, the command structure is complete, and the
Command Manager returns the top level command.
Delta processing:
WebSphere Adapter development overview 111