Quick tour of human-task persistence infrastructure
I had this picture lying around (in a git branch) and I figured I might as well make it available to others. It might not be totally accurate anymore with regards to the methods, but it is an accurate depiction of the framework.
What you see here is how persistence is structured in human-task: to start with, we have a
TaskService instance. When a human-task server or service instance gets a request (via a method call or message) to perform an operation, the
TaskService instance creates a
TaskServiceSession is our “request session”: it encapsulates the logic state and persistence state needed when handling the request. By logic state, I mean the variables and retrieve information needed to handle the task operation, and by persistence state, I mean the persistence context (entity manager) and transaction control state.
Actually, in order to seperate the persistence logic from the task logic, the persistence logic has been put into the
TaskPersistenceManager. That makes it easier to maintain (I hope?) and at least, for me, easier to read.
So far I’ve described the left hand side of the diagram:
The upper right hand side describes how the
TaskServiceSession instance is created: via a
Factory, of course. However, we wanted to provide Spring compatibility, so we have to implementations: one for “normal” situations, and one when using the human-task code with Spring. When we use Spring, we create a spring bean using the TaskSessionSpringFactoryImpl and inject that into our TaskService bean. Otherwise, the default is to use the (normal)
Transactions are also a concern that can differ: on the bottom right hand side, you’ll see we have 3 implementations of the TaskTransactionManager class: one for JTA, one for Local transactions and one for Spring transactions.
If you’re wondering what Spring transactions are, well, Spring provides an abstraction around local or JTA transactions. For example, Spring ‘local’ transactions actually have a synchronization point, even though normal local transactions don’t support that functionality.
Well, that’s about everything, I guess!