This lesson takes approximately 75 minutes to complete.
Viewing Screenshots
Move your mouse over this icon to show all screenshots.
You can also move your mouse over each individual icon to see only the screenshot
associated with it.
Overview
The lesson guides you through many of the tasks that
you must perform when using the JDeveloper Activity Modeler. The topics show
how to create a diagram of a simple integration point. The lesson is not meant
to be exhaustive in demonstrating all of the functionality of the activity modeler
and its integration code generation.
The scenario used for this lesson is more simple than
you would ever encounter in real life, but it serves to introduce the basic
steps that you would follow to create any diagram and generate messaging code,
regardless of the complexity.
You are designing an enterprise system that consists of order
entry functionality that interfaces with shipping.
Customers place orders with a clerk. On placement of an order,
the clerk sends a message to the Shipping department to fill the order. The
company wishes to automate this process so that once an order is taken it is
sent immediately to the Shipping department.
You examine this enterprise and use the activity modeler in
JDeveloper to diagram it. The final results should look similar to the diagram
shown below. You also use the code generation capabilities of the modeler to
create messaging code to integrate the two systems.
In order for this lesson to work successfully, you will need
to have performed the following:
1.
Install Oracle JDeveloper10g.
2.
If you want to generate messaging code from the diagram
you create in this lesson, you must define a database connection for each
swimlane in the diagram. In this lesson you create four swimlanes.
To generate messaging code, then, you must create four
database connections. These do not have to be valid connections to real
database serversyou can use arbitrary data to define the connections.
The only time you need valid database connections is when you deploy messaging
code.
To be consistent with the examples in this lesson,
name the database connections:
    hub_connection
    orders_connection
    shipping_connection
    inventory_connection
Start the lesson by creating an activity diagram
in a new, empty project. To create a new project and activity diagram, perform
the following steps:
1.
Create a new empty project in a new workspace:
In the Applications Navigator, right-click Applications
and choose New Application Workspace from the context menu.
In the Create Application Workspace dialog, rename the application Application1
to ActivityModeling. Notice that the directory name changes to
be the same.
From the list of available application templates, select No Template
[All Technologies], then click OK. The ActivityModeling application
is created and displayed as a node in the navigator, and a project is
automatically created.
Select Project in the Application Navigator and choose File
| Rename from the menu. In the Rename dialog, name the project OrderEntry
and click Save.
2.
Right-click the OrderEntry project in the Applications Navigator
and choose New from the context menu to open the New dialog.
3.
In the New dialog, select General > Diagrams in the Categories
columns, and UML Activity Diagram in the Items column.
Click OK.
4.
In the Create UML Activity Diagram dialog enter SimpleIntegration
as the name of the activity diagram, accept the default package name,
and click OK.
An empty diagram opens in JDeveloper.
5.
Click the Save All button
from the JDeveloper tool bar to save your changes.
Swimlanes typically correspond to the separate systems
in your enterprise. The business analysts who examined the enterprise concluded
that there are three systems: Order Entry, Shipping and Inventory. You decide
to model these systems using hub and spoke architecture to simplify the communication
between the systems. In hub and spoke architecture, every message is routed
through a central hub before being passed to the destination spoke.
To create the swimlanes which represent the Order Entry,
Shipping, and Inventory systems and the hub, perform the following steps:
1.
Click the Swimlane icon
in the Component Palette, then click in the diagram where you want to
create the swimlane.
2.
When the default swimlane name is highlighted on the diagram, enter the
name of the swimlane as OrderEntry,
then press Enter.
3.
Click the Save All button
from the JDeveloper tool bar to save your changes.
4.
You can now create the following swimlanes in the same way:
Create a swimlane called Shipping
below the OrderEntry
swimlane.
Create a swimlane called Inventory
below the Shipping
activity.
Create a swimlane called Hub
below the Inventory
swimlane.
An activity is a process that is performed in a business
or system. The business analysts who examined the enterprise have determined
that there are three activities: Take Order, Ship Order and Back Order.
To create the Take
Order, Ship Order, and
Back Order activities in the
diagram, perform the following steps:
1.
Click the Activity icon
in the Component Palette, then click in the OrderEntry
swimlane to the right of the vertical bar.
The element appears on the diagram panel. Note that the default name
of the activity is highlighted.
2.
Rename the activity: overtype the default name with Take
Order and press Enter.
Click the Save All button
from the JDeveloper tool bar to save your changes.
3.
You can now create the following activities in the same way:
Create an activity called Ship
Order in the Shipping
swimlane, to the right of the position of the Take
Order activity.
Create an activity called Back
Order in the Inventory
swimlane, below the Ship Order
activity.
An object flow state represents an event or message
that is passed between activities. The business analysts who examined the enterprise
have determined that there is one message, a new order (Order[new]), that is
being passed between the Take Order
and Ship Order activities and
the Take Order and Back
Order activities.
To create the Order[new]
object flow state, perform the following steps:
1.
Click the Object Flow State
icon in the Component Palette, then click on the diagram below the Take
Order activity in the Shipping
swimlane.
The object flow state is created on the diagram with name of the object
highlighted.
2.
Rename the object flow state (the name at the top of the shape) to Order
and press Enter. Rename the default classifier (the name at the
bottom of the shape) to new
and press Enter.
3.
You can reuse an object state with a different classifier to indicate
a change of state. To show that the order state changes to shipped after
the order is shipped, right-click the Order object state in the
diagram and select Copy from the context menu.
Right-click to the right of the Ship
Order activity and choose Paste from the context
menu.
Rename the classifier from [new
state] to [shipped]
by overtyping the name.
Click the Save All button
from the JDeveloper tool bar to save your changes.
Pseudostates are used in activity diagramming for combining
or splitting up transitions to indicate possible parallel (concurrent) and/or
mutually exclusive (alternative) paths through the activities of the model.
They also indicate the initial and final states of a diagram.
To create the INITIAL and OR states in the diagram (you will
create their associated transitions in Step 6), perform the following steps:
1.
Click the Initial State icon
in the Component Palette, then click to the left of the Take
Order activity in the Order Entry swimlane.
2.
Click the Or Decision Point/Join icon
in the Component Palette and click in the diagram to the right of the
Order object flow state
in the Shipping swimlane.
Click the Save All button
from the JDeveloper tool bar to save your changes.
A transition indicates the relationship between elements
in an activity diagram The object at the source end of the transition will perform
certain specified actions, and will then enter the destination end when a specified
event occurs or when certain conditions are satisfied. These conditions are
known as guard conditions.
Guard conditions must be specified on a transition in order
to generate code for a decision point.
To create transitions, perform the following steps:
1.
Shift-click the Transition icon
in the Component Palette.
The Transition icon remains highlighted.
2.
In the diagram, click the Initial pseudostate, then click the
Take Order activity.
3.
Click the Take Order
activity, then click the Order[new]
object flow state.
4.
Click the Order[new]
object flow state, then click the OR pseudostate.
5.
Click the OR pseudostate, then click the Ship
Order activity.
6.
Click the OR pseudostate, then click the Back
Order activity.
7.
Click the Pointer icon
on the Component Palette to stop creating transitions.
Click the Save All button
from the JDeveloper tool bar to save your changes.
If you wish, you can change the default colors and
fonts used to display activity model elements. To change colors and fonts, perform
the following steps:
1.
Right-click the model element, or right-click in the swimlane to left
of the vertical line (that is, the swimlane panel) and select Display
Properties.
2.
In the Display Properties window, select the font and color for the element:
Click Font in the left panel
of the Visual Properties dialog, then select your font preferences
Click Colors in the left panel of the Visual Properties dialog,
then select your color preferences.
3.
Click OK to apply your changes.
The above example shows changing the fill color to yellow and the font
to Times New Roman for the OrderEntry
swimlane.
Click the Save All button
from the JDeveloper tool bar to save your changes.
Note: You can change the default fonts and colors by
choosing Tools | Preferences | Diagrams | UML Activity Diagrams. The
properties that you set in this dialog affect all diagrams that you create after
changing these preferences.
Now that you have created your activity diagram, you
can use the E-Business Integration Wizard to define the systems in your integration,
and the specific properties for the channels.
To set e-business integration properties,
perform the following steps:
To define system instances for swimlanes, perform the following
steps:
1.
Click the OrderEntry
swimlane on the Overview page, then click Define Instance.
2.
Enter the Name (orders_instance),
Connection (select orders_connection
from the dropdown list)), and AQ Servlet URL (http://www.ourOrders.com).
Click OK.
3.
Click the Shipping
swimlane on the Overview page, then click Define Instance.
4.
Enter the Name (shipping_instance),
Connection (select shipping_connection
from the dropdown list)), and AQ Servlet URL (http://www.ourShipping.com).
Click OK.
5.
Click the Inventory
swimlane on the Overview page, then click Define Instance.
6.
Enter the Name (inventory_instance),
Connection (select inventory_connection
from the dropdown list)), and AQ Servlet URL (http://www.ourInventory.com).
Click the Hub swimlane
on the Overview page, then click Define Instance.
2.
Enter the Name (hub_instance),
Connection (select hub_connection
from the dropdown list)), and AQ Servlet URL (http://www.ourHub.com).
Click OK.
Note: The e-business integration code generator requires a database
connection to be defined for each swimlane you define. These do not have
to be valid connections to real database serversyou can use arbitrary
data to define the connections. The only time you need valid database
connections is when you deploy the generated files. See Prerequisites.
3.
Select the Hub radio button next to the Hub
swimlane entry on the Overview page.
A channel is a logical communication endpoint to or from applications.
Communication channels employ Oracle Advanced Queuing to send or receive messages.
The channel associated with the sending activity is known as the OUT channel,
which handles communications sent from this system to other systems. The channel
associated with the receiving activity is known as the TO channel. This channel
receives communication from other systems.
To define a channel for each instance, perform the following
steps:
1.
Click Next to display the Swimlanes page of the E-Business
Integration Wizard.
2.
Select the OrderEntry
swimlane, then click the New button next to the Channels
list box
3.
Enter the Name (outchannel),
Direction (select Out from the dropdown list), Queue
Name (orders_queue),
Implementation Type (select AQ from the dropdown
list), Queue Table (orders_queue_table),
and Protocol (select HTTP/HTTPS from the dropdown
list). You can click Help to see a description of these
properties.
Click OK.
4.
Select the Shipping
swimlane, then click the New button next to the Channels
list box
5.
Enter the Name (inchannel),
Direction (select In from the dropdown list), Queue
Name (shipping_queue),
Implementation Type (select AQ from the dropdown
list), Queue Table (shipping_queue_table),
and Protocol (select HTTP/HTTPS from the dropdown
list). You can click Help to see a description of these
properties.
Click OK.
6.
Select the Inventory
swimlane, then click the New button next to the Channels
list box
7.
Enter the Name (inchannel_2),
Direction (select In from the dropdown list), Queue
Name (inventory_queue),
Implementation Type (select AQ from the dropdown
list), Queue Table (inventory_queue_table),
and Protocol (select HTTP/HTTPS from the dropdown
list). You can click Help to see a description of these
properties.
Click OK.
Define Channels for Integration
Points between Instances
A decision point is a type of integration point where a decision
is made at run time as to the routing of the message. You can write complex
conditions in Java code, or use a guard condition that evaluates to a Boolean
value.
To add guard conditions for decision points, perform the following
steps:
1.
Click Next to display the Decision Points page of the E-Business
Integration Wizard.
2.
Click the OR2 -> Back Order decision point. Enter order.stockCode
>= 9000 in the Guard Condition field.
3.
Click the OR -> Ship Order decision point. Enter order.stockCode
< 9000 in the Guard Condition field.
Click Next to display the Summary page of the E-Business
Integration Wizard.
4.
Click Finish.
If all the e-business integration properties have been defined correctly
a dialog will be displayed stating that an e-business integration has
been correctly defined and can now be generated.
5.
Click Yes to return to the start of the wizard
to generate integration point messaging code.
Step 9 - Generating
the Integration Point Messaging Code
Once you have constructed the diagram and entered all
of the properties for all of the elements, you can generate messaging code.
Note: The e-business integration code generator requires
a database connection to be defined for each swimlane for which you are generating
messaging code. These do not have to be valid connections to real database serversyou
can use arbitrary data to define the connections. The only time you need valid
database connections is when you deploy the generated files. See Prerequisites.
If you do not have a database connection defined for a swimlane,
the generator will return an error in the JDeveloper Log window and will not
generate code.
To generate messaging code, perform
the following steps:
1.
Select the Generate check box next to the Take Order ->
Back Order, Ship Order integration point, then click Finish.
2.
Click OK to start code generation.
A progress monitor opens and tracks the file generation. The progress
is also recorded in the log window. Click OK to dismiss the alert
box that opens when generation is complete. The generator creates a Generated
EBI Files folder in the Navigator window and stores the generated files
under it.
3.
Click the Save All button
from the JDeveloper tool bar to save your changes.
When the activity modeler generates the integration files,
it stores them in the file system and displays them in the JDeveloper Navigator
window. The generation produces a three-deep hierarchy of folders.
At the top level, the generator creates a Generated EBI
Files folder for the project. This folder contains a folder for each swimlane
that has been defined in the project. Each swimlane folder contains a folder
for each diagram in which it is used. Each diagram folder contains the generated
integration files that will enable messaging between the systems.
For the diagram created in this lesson, the integration generator
creates the Generated EBI Files top-level folder. Beneath this, it creates
a Swimlane Hub, a Swimlane Shipping, a Swimlane Inventory
and a Swimlane OrderEntry folder. Beneath each of these folders is a
folder for each diagram in which the swimlane is used. In this case, the swimlanes
are used in only one diagram: SimpleIntegration.
In the diagram created in this lesson, the Shipping,
OrderEntry and Inventory
swimlanes represent systems that act as the spokes in a hub-and-spoke architecture.
For these systems the generator creates an instanceInformation.xml
file and an AQDefinitions.xml
file.
As its name suggests, the instanceInformation.xml
file contains the information that you entered in the Instances tab of
the Swimlane Properties dialog which is specific to each instance belonging
to the system. This XML file contains the system name and ID, instance name
and ID, and connection information for each instance defined for the system.
The AQDefinitions.xml
file contains the information that you entered for the system in the Channels
tab of the Swimlane Properties dialog: the direction of the channel communications,
the communications protocol, and the name of the AQ queue and queue table in
which it should be stored. All other properties of the queue will be set to
their default values when the queue is created. AQDefinitions.xml
uses the instance information file to find the name of the database connection
that it will use to access the target system.
The Hub swimlane,
as its name suggests, represents the system that acts as the hub in a hub-and-spoke
architecture. The Hub system will receive any messages which are sent between
the systems and route them to their appropriate targets.
In addition to an instanceInformation.xml
and AQDefinitions.xml file, the
integration generator creates three additional files for the Hub system and
stores them in the Swimlane Hub folder:
The BESDefinitions.xml
file is created for the hub because it controls the routing of messages
between systems. This file stores the names of the systems, agents, events,
and event subscriptions that will be used in messaging between the hub
and the other systems. During deployment, only events are deployed without
modification. BESDefinitions.xml
uses the instance information file to make the following modifications
to system, agent, and event subscription information for deployment:
one system definition is assigned for
each system instance
one agent for each instance is assigned
to each channel
one event subscription is assigned
to each instance of a target system
The presence of a hub will force a workflow WorkflowDefinitions.wft
file to be generated for the simple integration point. Although there
is no complex routing or decision making in this example, workflow interprets
any integration point as an event, regardless of whether it is a simple
integration point or a more complex case, such as a decision point. The
workflow file can be displayed in Oracle Workflow Builder (if Workflow
Builder is installed) by right-clicking on the .wft
file, which enables you to see the workflow that has been generated and
modify it before deployment if necessary.
RoutingLogic<diagram_name>.java
determines the routing of messages through decision points and to multiple
instances.