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

Related Topics: Weblogic

Weblogic: Article

E-State: An Enterprise State Machine

A framework inspired by ROOM

E-State and Workflow
Workflow and state machines are, as argued in my earlier article, "State Machines and Workflow" (WLDJ, Vol. 3, issue 1), complementary implementation strategies for process-oriented applications. The state approach is a powerful abstraction for the succession of milestones found in many business processes. On the other hand, workflow - in particular, the Business Process Modeler (BPM) component of BEA WebLogic Integration - provides important enterprise-level services, such as external system integration, human worklist and task management, events and timers, and XML messaging processing. As the earlier article pointed out, a hybrid state-workflow solution has the following parts:

  1. A state machine framework, consisting of:
    - A state model: A set of states and transitions, expressed in an XML document.
    - Actor database: An entity that has state. The state of the actor is persisted to a database by the state machine.
    - State machine engine: Injects events into an actor's state model and updates state accordingly. It also calls user-defined action classes when a state is entered or exited or a transition occurs.
    - Action classes: User-defined Java classes that respond to the entry or exit of a state or the execution of a transition for an actor in a given state model.
  2. A BPM workflow that receives an event and injects it into the state machine.
  3. A BPM workflow that sets a timer and injects a timeout event into the state machine when the timer expired.
  4. A BPM workflow that is called by a state action to assign a worklist task or interact with an external system.
E-State is a reference implementation of the first part: the state machine framework. This article discusses its architecture.

E-State Architecture

E-State's state models are based on those in the Real-time Object-Oriented Modeling (ROOM) methodology. ROOM state charts are hierarchical, meaning that a given state can have substates. This simple idea is disproportionately powerful. Flat state models simply don't scale from a human understanding point of view. As the number of states and transitions increases, the flat model becomes too hard to comprehend. Hierarchical state models can be understood in pieces, each piece being relatively simple to conceive. For example, consider Figure 1.


In this model the transition ab leads either of states a1 or a2 to state b; similarly, the transition ac causes the state to change from a1 or a2 to c. The transition toC for all states causes the state to change to c. Transition ba in state a1 results in the new state b. The initial state is b. The state changes from a1 to a2 on transition a1a2, and from a2 to a1 on a2a1. Transition ca leads to a choice point: if the last a state is a1, it leads to a1, otherwise a2.

The hierarchical version of this scenario, depicted in Figure 2, is easier to understand.


First, states a1 and a2 are factored out as superstate a (right diagram); the overall picture (left diagram) is cleaner. Transitions ab and ba, from the perspective of the top state, simply shift between states a and b; but in state a we see that ba leads to substate a1, whereas ab originates from a1. The transition ac leads from either a1 or a2 to c; the transition ca leads from c to the last substate of a. In addition, the toC transition no longer needs to originate from each state; to event from the top state's nonextending transition point toC to state c satisfies the intended behavior.

As a consequence of its hierarchical design, ROOM offers two powerful features: group transitions and transitions to history. A group transition is one that occurs for a given state no matter what substate it is in; transition ac leads from state a to c regardless of whether a's substate is a1 or a2. A transition to history is a transition into the most recent substate of a given state; transition ca brings state c to the last substate of a.

Alternative methodologies are UML and Petri-nets, each of which supports hierarchical structures.

The heart of E-State is a stateless session Enterprise JavaBean (EJB) called StateMachine, which is shaded in the diagram in Figure 3.


The StateMachine EJB is configured to point to a particular state model, which is an XML file specifying, for a given application, the following:

  • A set of states and a set of transitions
  • A unique namespace, which enables multiple deployments, as discussed below
  • The name of the Java "action'' callback class that the state machine invokes while processing an event
The EJB applies the model to "actors." An actor, in ROOM methodology, is an "active" object whose behavior is best described with a state model. (In ROOM, an active object also has its own control thread of and its own set of inbound and outbound messaging interfaces. E-State's notion of an actor is more restrictive.) In E-State, an actor is an entity that has state, such as an insurance claim. The transition from one state to another in a model reflects the change in state of the actor; for example, a claim can be waiting, activated, or idle. E-State has three tables that track the state of an actor, namely Actor, Actor_Property, and Actor_State, and has corresponding entity EJBs (Actor, ActorProperty, and ActorState) to represent them, as shown in Figure 3. The StateMachine EJB is in part a facade to these entity EJBs; its actor-management methods include createActor(), getCurrentState(), getChildState(), getActorProperty(), getActorProperties() and setActorProperty().

The remaining methods of StateMachine (startMachine() and injectEvent()) constitute the engine that drives an actor's change of state. Actually, startMachine(), simply calls injectEvent(), passing the special "initial" event type to it, to execute the transitions originating from the initial transition points of each state in the model. The injectEvent() method, then, is the heart of the machine that moves the action of the business process along. This method invokes methods of the user-defined action class along the way, implementing the interface StateAction that is defined with the model. The purpose of the action class is to notify the client of important state machine events and to request logical decisions. The methods of the action class are shown in Table 1.


In the insurance example, action classes start workflows to perform task-related or cleanup work, or to start a timer. In WebLogic Integration 7.0, a workflow is started with the BPM API. In WebLogic Integration 8.1, the workflow is called as a Web service.

The methods of the StateMachine EJB are summarized in Table 2.


In the insurance example, the injector workflow calls the injectEvent() of the state machine. In WebLogic Integration 7.0, the workflow uses a business operation to call this method. In WebLogic Integration 8.1, it uses an EJB control.

Database Schema
Figure 4 shows the structure of tables to hold persistent actor state information.


The main table, Actor, stores the current state of an actor for a particular model type. The current state is the leaf state that the actor is currently in. The primary key is a combination of the actor's unique identifier and its model namespace. An actor can have state in several model namespaces. Notably, if two versions of a model exist with distinct namespaces, the actor's state in each can be represented in the actor table.

The Actor_State table captures the active substate of each composite state of a given actor in a given namespace. This table is for internal use only; the engine uses it to process transitions to history. There is a one-to-many relationship between actor and actor_state.

The Actor_Property table stores user-defined properties for an actor in a given namespace. A property has a name (which is unique per actor per namespace), a type, and a value. This table is provided as a convenience to client applications to associate a set of data with an actor; more likely, that data is held in an application-specific data store.

A different instance of the StateMachine EJB is deployed for each state model. The source code is the same for each (same home and remote interfaces, same implementation), but the configuration is different. The deployment descriptor for the EJB specifies a unique Java Naming and Directory Interface (JNDI) name (which clients use to locate EJB), as well as a reference to an XML file containing the model itself. For example, the StateMachine EJB for the insurance state model might have the JNDI name "state_insurance" and point to file "Insurance.xml". To interact with this model, a client application accesses its EJB with the "state-insurance" JNDI name and calls its methods. This peculiar approach has significant advantages:

  • Life cycle: To make a new state model available for processing means to deploy a StateMachine EJB that points to it. To decommission that model means to undeploy that EJB. To promote a change to the model means to redeploy the EJB with the modified model file.
  • Versioning: If an existing state model has a new major version, the new version can be deployed as a separate EJB and coexist with the earlier version. For example, "state-insurance-1.1" can coexist with "state-insurance".
The data model is also conducive to versioning. A given actor can have persistent state for multiple models, including different versions of the same model, as long as the models have distinct names.

Most business processes run for a long time, which makes the management of application upgrades especially challenging. Two scenarios are hard to solve:

  1. A minor patch where there are actors in progress on the unpatched release.
  2. A major patch meant only for new actors; old actors are to continue with the earlier version.
E-State is an intelligent solution to these problems:
  1. Applying the minor patch means redeploying the existing EJB for that model. The actors will pick up where they left off, but with the patch in place.
  2. Applying the major patch means deploying a new EJB with a distinct namespace, but keeping the existing EJB deployed as is. The models are independent, allowing old actors to continue with the earlier release while new actors use the new release.
E-State is an enterprise state machine framework inspired by the ROOM methodology that, when combined with BPM workflows offering key integration services such as systems integration, events, timers, worklist, and XML, provides powerful solutions for development of process-oriented business applications. E-State includes a runtime engine, a schema for state models, persistence services, and user-defined "action" classes, which are invoked by the engine when a transition occurs, or when a state is entered or exited. The action classes likely call workflows to leverage BPM services; workflows, in turn, when triggered by events, call the engine to trigger transitions.


  • Selic, Gullickson, and Ward. (1994). Real-Time Object-Oriented Modeling. Wiley.
  • More Stories By Michael Havey

    Michael Havey is a Chordiant consultant with 10 years of industry experience, mostly with application integration. Michael's book Essential Business Process Modeling was published by O'Reilly in August 2005.

    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
    "Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
    SYS-CON Events announced today that Conference Guru has been named “Media Sponsor” of the 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. A valuable conference experience generates new contacts, sales leads, potential strategic partners and potential investors; helps gather competitive intelligence and even provides inspiration for new products and services. Conference Guru works with conference organizers to pass great deals to gre...
    The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform. In his session at @ThingsExpo, Craig Sproule, CEO of Metavine, demonstrated how to move beyond today's coding paradigm and shared the must-have mindsets for removing complexity from the develop...
    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...
    "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.
    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 ...
    Widespread fragmentation is stalling the growth of the IIoT and making it difficult for partners to work together. The number of software platforms, apps, hardware and connectivity standards is creating paralysis among businesses that are afraid of being locked into a solution. EdgeX Foundry is unifying the community around a common IoT edge framework and an ecosystem of interoperable components.
    Large industrial manufacturing organizations are adopting the agile principles of cloud software companies. The industrial manufacturing development process has not scaled over time. Now that design CAD teams are geographically distributed, centralizing their work is key. With large multi-gigabyte projects, outdated tools have stifled industrial team agility, time-to-market milestones, and impacted P&L stakeholders.
    "Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, 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.
    "IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
    In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objectively discuss how DNS is used to solve Digital Transformation challenges in large SaaS applications, CDNs, AdTech platforms, and other demanding use cases. Carl J. Levine is the Senior Technical Evangelist for NS1. A veteran of the Internet Infrastructure space, he has over a decade of experience with startups, networking protocols and Internet infrastructure, combined with the unique ability to it...
    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 ...
    "Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
    Gemini is Yahoo’s native and search advertising platform. To ensure the quality of a complex distributed system that spans multiple products and components and across various desktop websites and mobile app and web experiences – both Yahoo owned and operated and third-party syndication (supply), with complex interaction with more than a billion users and numerous advertisers globally (demand) – it becomes imperative to automate a set of end-to-end tests 24x7 to detect bugs and regression. In th...
    "MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, 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.
    Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
    "There's plenty of bandwidth out there but it's never in the right place. So what Cedexis does is uses data to work out the best pathways to get data from the origin to the person who wants to get it," explained Simon Jones, Evangelist and Head of Marketing at Cedexis, 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.
    SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
    SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
    It is of utmost importance for the future success of WebRTC to ensure that interoperability is operational between web browsers and any WebRTC-compliant client. To be guaranteed as operational and effective, interoperability must be tested extensively by establishing WebRTC data and media connections between different web browsers running on different devices and operating systems. In his session at WebRTC Summit at @ThingsExpo, Dr. Alex Gouaillard, CEO and Founder of CoSMo Software, presented ...