Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

A Simple ADK for WLI's Business Process Management

A Simple ADK for WLI's Business Process Management

WebLogic Integration (WLI) consists of many application components, including a B2B application that manages business-to-business contracts during software conversation. To support the B2B application, WLI has a business process management (BPM) application for connecting business processes together. This used to be marketed as a discrete product, WebLogic Process Integrator (WLPI).

The BPM application's ADK requires the application developer to understand the architecture of the BPM application. The ADK has a number of components whose use depends on the state of the workflow and the operation that's required. Interaction with the BPM ADK's components and objects leads to an application developer coding to a low level interface.

This article outlines the design of a simple facade to the BPM ADK, providing a clean object interface that is, by intent, easy to use. It simplifies interaction with the BPM engine and ensures that changes in the underlying BPM implementation won't affect the ADK adversely. Access to the BPM application is solely via the publicized WLPI interface.

Using the Simplified ADK
In creating this ADK I wanted to produce a simple object model that could be used within either a Java client or a JSP. Due to the nature of the BPM application there are many state objects. For example, an InstanceInfo object describes a running workflow and a TaskInfo object describes a task. These state objects have no direct association with each other, but have a relationship based on the underlying RDBMS.

Programming to the BPM ADK led to code that, while meeting the application requirements, was both difficult to read and hid my intent in low-level detail. When I programmed to the BPM ADK directly, there was a tendency to parse XML documents frequently and a lot of interaction with EJB components that didn't appear, at first glance, to have any direct responsibility for the operation I required. For example, the Admin EJB is responsible for finding out what tasks are available in a workflow and the Worklist EJB is responsible for executing the task in the workflow.

In the WLI ADK, interaction with the workflow is indirect, with the workflow described by an InstanceInfo object. The InstanceInfo attributes are used in interactions with the Worklist component or the Admin component to effect a change in the workflow state. This led to code that was often difficult for a reader new to the BPM interface to understand, which caused me concern over the long-term maintenance of the code base.

Using the facade design pattern, I produced a simplified ADK to the BPM application. The first step was to understand the main use cases and key entities that most BPM applications have. The use cases in many BPM clients are:

  • Find out what workflows the user could start and then start one of them
  • Execute a task (or mark it as done)
  • Set or get a workflow variable's value
  • Stop a workflow
The BPM application would then be responsible for interacting with other applications to satisfy the business process.

ADK Key Concepts
In most applications the key entities for interaction with the BPM interface were often found to be User, Workflow, Task, and Variable, as workflows are inherently stateful (see Figure 1).

IUser
The IUser is a simple interface. Its contract states that the user should be identifiable and have an organization. As I show below, the WLIUser class is the entry point to the BPM ADK.

IWorkflowController
The IWorkflowController is a simple interface with two main overloaded methods, getAvailableWorkflows and getRunningWorkflows. I defined an available workflow as one that the user can start and a running workflow as one that has been started. I intended to make the controller an intelligent factory, removing the need to create a workflow instance directly. If the underlying BPM application changes, with this mechanism the ADK's clients would then be decoupled from the change.

IWorkflow
The IWorkflow interface says that a workflow can be started and stopped, variables set and read, and a set of tasks (ITask) can be accessed. It doesn't expose all the information that a WLI workflow can contain. It does, however, capture what I felt was the general essence of the workflow that I felt sufficient when exploring the ADK's design. Future implementations of the interface may expose more information.

In this ADK a workflow can have three main states: defined, running, and stopped. A defined workflow is defined within the BPM studio. It has tasks and may have workflow variables defined. Defined workflows can have instances created if the permissions of the workflow allow it. A workflow instance is a running workflow. Running workflows can have tasks waiting to be executed and may have workflow variables to set. A stopped workflow is a workflow instance that's been stopped. In this stopped state Workflow variables can be read, but their values can't be set.

Variables
A workflow variable can have many types, from Java objects to XML documents. These are defined in the WLI documentation. This ADK is designed to work with most forms; however, only the XML variables are currently implemented. The problem was how to get variables into WLI. As a Java variable could have many classes, in addition to BPM applications having different or changing ways of setting a workflow variable, there was a design challenge. By applying the Mediator pattern it became simple to define a variable formatter to overcome the system boundary (see Figure 2).

Tasks
A workflow task is defined within the BPM studio. The Task is a collection of actions. This ADK does not interface with the actions directly, as this is the domain of the BPM application. My intent is to delegate the process logic to the BPM engine rather than have it hard-coded. The task interface defines operations to query the state of the task and to execute the task.

Use-Case Model
The process I adopted for this development was to implement the ADK in a use case­driven manner, the use cases providing the impetus to understanding how the ADK could be used. The application I produced was a simple command line interface to the workflow system. The command line application would be able to start and stop workflows, execute tasks in a workflow, and set and get workflow variables. The simple use-case model is shown in Figure 3.

Use-Case Realizations
I use a single use-case realization to describe the ADK design.

Starting A Workflow With Variable
In this use case we need to start a workflow for a user see Figure 4. The workflow should have a value passed to it before starting. In WLI BPM this is where a workflow that has a mandatory input variable is defined.

The IWorkflowController creates a list of IWorkflow objects depending on whether the client requires a new workflow started or an existing workflow. Creation of WLIWorkflow objects is only via the IWorkflowController interface and the class WLIWorkflowController, shown in Figure 5, realizes this interface. The workflow controller is responsible for generating lists of workflows based on the user's permissions. How the permissions affect the starting of a workflow is dependent on the underlying workflow engine. A WLI user can belong to multiple organizations with one organization specified as the user's default organization. For this iteration of the ADK I decided that the WLIWorkflowController would only access workflows in the user's default organization.

An instance of WLIWorkflowController is normally created with a WLIUser object specified. The WLIUser class acts as a facade to the underlying WLIPrincipal remote interface and UserInfo class. It creates an association to the underlying UserInfo object. I decided to keep the IUser interface simple since it focuses on the use cases described above.

ADK Code Walk
To illustrate how the ADK can be used, we'll walk through the pseudo code in Listing 1.

In line 1 a WLIUser object is created and the J2EE connection information is supplied, along with the organization that the user will belong to for this interaction. The J2EE connection information object is a data structure for holding all properties required to open the JNDI initial context. At line 2 the WLIWorkflowController is created for the user. Line 3 illustrates the use of the workflow controller to get the workflows that are available to the user. Lines 4 through 7 are interactions with the user. In line 8 I create a WorkflowVariable that's an instance of XMLWfVar (XML Workflow Variable) and in line 9 a value for the variable is set. Line 10 introduces the concept of the VariableFormatter, discussed below. The workflow variable is associated with the workflow in line 12. Finally, the workflow is started.

WLI Implementation
In this section I'll discuss the design of the ADK with regard to the underlying WLI implementation.

WLIUser
The class WLIUser aggregates a reference to the WLPIPrincipal EJB, which is responsible for accessing the security principal of the caller. The call

theUserInfo = principal.getUserInfo(userId);

returns a state object of class UserInfo. The WLIUser object caches this state, and maintains the reference to the WLPIPrincipal. Access to the WLPIPrincipal cache is available to other classes in the Java package.

WLIWorkflowController
The WLIWorkflowController uses a reference to the Worklist EJB. For a call to WLIWorkflowController.getAvailableWorkflows(), the code in Listing 2 shows that the workflow list is first configured for the caller's organization. The call to Worklist::getStartableWorkflows returns a list of TemplateInfo objects that are used to create WLIWorkflows.

The WLIWorkflowController passes a reference to the BPM's Admin EJB to the WLIWorkflow on construction of the WLIWorkflow. This EJB is used to control access to the workflow variables.

To access running WLI workflows the client would use the method WLIWorkflowController.getRunningWorkflows(). The code snippet below shows the mechanism used within the ADK. Access to running workflows in the WLI ADK is not via the Worklist EJB, but rather by the Admin EJB.

instanceList =
admin.getTemplateInstances(wf.getId(),
user.getOrganisation().getId(),
true,from,to,0,0);

To find a running workflow, the ADK must first find workflows that the user can start. Once the list of workflows that can be started is created, the ADK queries the Admin EJB to find out which workflow templates have running instances. The simplified ADK hides the client from this complexity.

WLIWorkflow
The WLIWorkflow object is created with a reference to the Admin and Worklist EJBs. These EJBs are the main access route for workflows into the BPM application. If the Workflow is being created for a workflow that has not yet been started (i.e. in a defined state), the WLIWorkflow object must be created with a reference to the com.bea.wlpi.common.TemplateInfo object for the workflow. The BPM's TemplateInfo class is responsible for encapsulating simple information about a template's instance. The Worklist EJB in the WLIWorkflowController returns the TemplateInfo object.

Should the workflow be running, the WLIWorkflow object must be created with a reference to a com.bea.wlpi.common.InstanceInfo object. This contains state information about the workflow and is used by the WLIWorkflow object to access task information.

Starting a workflow in WLI is achieved in one of two ways. The mechanism depends on if the workflow has had variables associated with it. I wanted to hide this from my ADK's clients.

If we have a workflow in a defined (nonstarted) state, the WLIWorkflow object starts the workflow as follows:

wList.instantiateWorkflow(
wList.getActiveOrganization(),
wfTemplate.getId());

The instantiateWorkflow() method in com.bea.wlpi.server.worklist.Worklist is used, and has the organization and the template identifier passed to it. To me, this mechanism doesn't manipulate workflows; rather, it relies on the client to track template identifiers and organizations. I wanted to hide this level of detail from the ADK's clients; treating the Workflow as an entity in the design allowed me to use the facade pattern to abstract the client away from the underlying WLI complexity. The importance of this is further underlined when setting variables in running workflows or manipulating tasks.

If the workflow has variables to be passed to it before starting, the ADK's clients need to have invoked setVariable on the WLIWorkflow object. The workflow object caches the variables in a HashMap, which is then passed to the overloaded instantiateWorkflow() method defined in com.bea.wlpi.server.worklist.Worklist.

Variables
The ADK's concept of Workflow Variables has already been introduced above. In Figure 2 I showed the class diagram for the workflow variables and variable formatters. A key design consideration was to decouple the ADK's clients from the underlying variable structure that a BPM engine required. In WLI's BPM application the variables are passed to the workflow instance via either the com.bea.wlpi.server.admin.Admin EJB or the com.bea.wlpi.server.worklist.Worklist EJB. The Worklist EJB is used if the workflow is to be started in the same call. If the workflow has already started, the Admin EJB is used.

In the Worklist EJB, passing a hashmap of the variable objects to the instantiateWorkflow() method sets the input variables. The keys to the hash map are used for the variable names; the object in the hash map is used for the variable value.

In the Admin interface, the method below can be used:

admin.setInstanceVariable
(instanceInfo.getTemplateDefinitionId(),
instanceInfo.getId(),
var.getName(),
var.getFormatter().getObjectFormattedVariable());

I wanted the clients to be abstracted from the complexity required to support multiple variable formats. The Mediator pattern was an excellent solution for this required decoupling. Now the client can set a workflow variable on a workflow and the client doesn't need to be aware of the underlying mechanism that the BPM requires, or the format of the workflow variable. The client needs only to associate the correct variable formatter with the variable.

Tasks
In the WLI BPM, application tasks are where operations are performed. These may be manual actions that a user must undertake, or a programmatic action that allows the BPM to integrate existing application processes. If a task is accessed within a Java application, then the application is interrogating the state of the task to either monitor the progress of the workflow or use the task as an indicator that the application is required to undertake some manual action. If this isn't the case, then it's probably that there are better mechanisms to achieve the requirement, such as using JMS signals from the BPM.

In the ADK, tasks can have one of the following states: started, completed, or inactive. WLI has an overdue state which isn't currently supported. An inactive task is one that's defined in the BPM, but the preconditions for its starting haven't yet been met. A started task is one where all of its preconditions are met and the automatic processing of the task's actions has started. A completed task has completed all of its actions and been marked done. Marking a task as done can trigger additional processing within the task. For this reason, we execute a task within the ADK. This signifies that there may be processing yet to be done. Once the task is executed (all actions are performed) then the task is completed.

Access to a WLI workflow's tasks is via the com.bea.wlpi.server.admin.Admin EJB using the method:

List lst = admin.getInstanceTasks(instanceInfo.getId());

This method returns a list of com.bea.wlpi.common.TaskInfo objects. As a workflow has tasks, I did not want to expose the Admin EJB to the ADK's clients. Using the IWorkflow::getTasks() method, the client can access tasks directly from the workflow object. This method will return a list of ITask objects. Once the client has the task object it can manipulate the task without having any dependency on the Admin EJB.

Executing the task requires an interaction with the com.bea.wlpi.server.worklist.Worklist EJB. The method used within the simple ADK is shown below:

wList.taskExecute(taskInf.getTemplateDefinitionId(),
taskInf.getInstanceId(),
taskInf.getTaskId());

Currently, the WLITask doesn't have any method for waiting for task completion. The WLI BPM application is designed to support tasks that are very long running, spanning days or months. I've stayed away from specifying this behavior in the task interface. Should ADK clients require this functionality, then I believe they should be aware of the implications!

Conclusion
I've outlined the design of a simple facade ADK to the WLI BPM application. The WLI BPM, while not very complex, requires that the developer be aware of the BPM architecture. This facade uses the key concepts of User, Workflow, Task, and Variable to make the processing of workflows independent of the BPM application. As the BPM application matures, the need for a façade like this may decrease. For now, this facade provides an abstraction from the underlying middleware.

More Stories By Andy Winskill

Andy Winskill is principal consultant at Rosewood Software Services Ltd., UK. He specializes in BEa and Rational softwre, and has more than 10 years of experience in designing and constructing EAI and B2B applications. Rosewood Software Services are BEA and Rational partners.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
With tough new regulations coming to Europe on data privacy in May 2018, Calligo will explain why in reality the effect is global and transforms how you consider critical data. EU GDPR fundamentally rewrites the rules for cloud, Big Data and IoT. In his session at 21st Cloud Expo, Adam Ryan, Vice President and General Manager EMEA at Calligo, examined the regulations and provided insight on how it affects technology, challenges the established rules and will usher in new levels of diligence arou...
SYS-CON Events announced today that Evatronix will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
Cloud Expo | DXWorld Expo have announced the conference tracks for Cloud Expo 2018. Cloud Expo will be held June 5-7, 2018, at the Javits Center in New York City, and November 6-8, 2018, at the Santa Clara Convention Center, Santa Clara, CA. Digital Transformation (DX) is a major focus with the introduction of DX Expo within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive ov...
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
Smart cities have the potential to change our lives at so many levels for citizens: less pollution, reduced parking obstacles, better health, education and more energy savings. Real-time data streaming and the Internet of Things (IoT) possess the power to turn this vision into a reality. However, most organizations today are building their data infrastructure to focus solely on addressing immediate business needs vs. a platform capable of quickly adapting emerging technologies to address future ...
In his session at 21st Cloud Expo, Raju Shreewastava, founder of Big Data Trunk, provided a fun and simple way to introduce Machine Leaning to anyone and everyone. He solved a machine learning problem and demonstrated an easy way to be able to do machine learning without even coding. Raju Shreewastava is the founder of Big Data Trunk (www.BigDataTrunk.com), a Big Data Training and consulting firm with offices in the United States. He previously led the data warehouse/business intelligence and B...
"Digital transformation - what we knew about it in the past has been redefined. Automation is going to play such a huge role in that because the culture, the technology, and the business operations are being shifted now," stated Brian Boeggeman, VP of Alliances & Partnerships at Ayehu, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"Evatronix provides design services to companies that need to integrate the IoT technology in their products but they don't necessarily have the expertise, knowledge and design team to do so," explained Adam Morawiec, VP of Business Development at Evatronix, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
The 22nd International Cloud Expo | 1st DXWorld Expo has announced that its Call for Papers is open. Cloud Expo | DXWorld Expo, to be held June 5-7, 2018, at the Javits Center in New York, NY, brings together Cloud Computing, Digital Transformation, Big Data, Internet of Things, DevOps, Machine Learning and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding busin...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, led attendees through the exciting evolution of the cloud. He looked at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering m...
Nordstrom is transforming the way that they do business and the cloud is the key to enabling speed and hyper personalized customer experiences. In his session at 21st Cloud Expo, Ken Schow, VP of Engineering at Nordstrom, discussed some of the key learnings and common pitfalls of large enterprises moving to the cloud. This includes strategies around choosing a cloud provider(s), architecture, and lessons learned. In addition, he covered some of the best practices for structured team migration an...
No hype cycles or predictions of a gazillion things here. IoT is here. You get it. You know your business and have great ideas for a business transformation strategy. What comes next? Time to make it happen. In his session at @ThingsExpo, Jay Mason, an Associate Partner of Analytics, IoT & Cybersecurity at M&S Consulting, presented a step-by-step plan to develop your technology implementation strategy. He also discussed the evaluation of communication standards and IoT messaging protocols, data...
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, discussed how they built...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
22nd International Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, and co-located with the 1st DXWorld Expo will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud ...
DevOps at Cloud Expo – being held June 5-7, 2018, at the Javits Center in New York, NY – announces that its Call for Papers is open. Born out of proven success in agile development, cloud computing, and process automation, DevOps is a macro trend you cannot afford to miss. From showcase success stories from early adopters and web-scale businesses, DevOps is expanding to organizations of all sizes, including the world's largest enterprises – and delivering real results. Among the proven benefits,...
@DevOpsSummit at Cloud Expo, taking place June 5-7, 2018, at the Javits Center in New York City, NY, is co-located with 22nd Cloud Expo | 1st DXWorld Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait...
SYS-CON Events announced today that T-Mobile exhibited at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on qua...