31.01.2015 Views

SOA Magazine IV 01.2015

SOA Magazine IV 01.2015

SOA Magazine IV 01.2015

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Custom BPM Library – BpmLib<br />

Looking in more detail to the BpmLib component, it is a java library that is responsible for all the calls to<br />

the BPM API, and returning our custom data types, creating an abstraction layer over the BPM API. It<br />

also has other functions like caching and preprocessing data for the ADF interface generation.<br />

Creating an abstraction layer has all the normal advantages, and in our case have helped us to expose<br />

custom methods in the way we needed them in order to achieve our final goal. The API is very powerful,<br />

allowing all kinds of interactions with the underlying engines. But since we only needed a subset of<br />

those functionalities that meant that there were many options in the API that we didn’t need. We used<br />

the BpmLib to hide those options, for instance when querying processes and tasks the API allows us to<br />

define which columns we want to be returned. This library "hides" that functionality and always returns<br />

the same columns. Another example is the use of flex fields on human tasks. Since we return our own<br />

custom made classes we already include in them the business data that’s stored in the flex fields so that<br />

the upper layers don’t have to be concerned with the origin of the data. Using our own classes also<br />

allows us to flatten the class structure, simplifying access to the other fields.<br />

Instantiating the service objects of the API is a heavy operation and as such we cache those objects.<br />

However this raises a problem, this library is running on a different managed server than the <strong>SOA</strong> and<br />

BPM Suite. When the <strong>SOA</strong> managed server is restarted, the connection becomes invalid, and all calls to<br />

the API throw a javax.ejb.EJBException. We had to include a mechanism to catch those exceptions and<br />

invalidate the service cache. On the other hand, since all managed servers are clustered, we did not<br />

need to account for unavailability of the <strong>SOA</strong> managed server. Given that in the case of unavailability of<br />

the <strong>SOA</strong> managed server most of the functionality would be unavailable anyway, that was not a<br />

requirement.<br />

Other cached data is the security contexts of the users. Users are authenticated by the ADF<br />

infrastructure, but with that information we then need to create the security contexts that the BPM API<br />

uses. Since this creation is also a heavy operation we cache these contexts. However we had to be<br />

careful to not create vulnerabilities that would allow a user to use the cached context of another. We<br />

also had to invalidate each entry regularly to allow new security definitions, like group and role<br />

membership changes, to be picked up.<br />

Regarding the automatic generation of human tasks interface, this library is responsible for fetching and<br />

preprocessing the payload of the tasks so that ADF layers can generate the interface.<br />

On the BPM side we define the task payload using not only the base XSD types like string and date, but<br />

also other custom types, ranging from generic types like text to indicate to the interface generator that<br />

the field should be rendered has a text area, to other, more business specific types, like account, which<br />

the generator knows how they have to be rendered. This also includes types that have to be rendered as<br />

several controls. These type definitions are deployed to MDS allowing us to share them across<br />

Copyright © 2015 | All Rights Reserved <strong>SOA</strong> <strong>Magazine</strong> <strong>IV</strong> 24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!