[jboss-dev-forums] [Design of JBoss jBPM] - Re: Command facade API
tom.baeyens@jboss.com
do-not-reply at jboss.com
Tue Feb 26 09:55:00 EST 2008
the command pattern is only an intermediate step towards a normal session facade interface.
the idea is that process languages like jPDL still could offer a session facade with normal methods, typed return values and typed parameters. these could then be implemented in terms of the command.
such a session facade would look like this
public class JpdlService extends CommandService {
| Execution startProcess(String processName);
| Execution signal(long executionId);
| ...
| }
impl would be something like this
public class JpdlServiceImpl extends CommandServiceImpl implements JpdlService {
| public Execution startProcess(String processName) {
| return (Execution) execute(new StartProcessCommand(processName));
| }
| ...
| }
There are 2 motivations for this approach
1) graph retrieval.
A typical session facade doesn't have a way to specify how much of the returned object graph needs to be eagerly initialized. When navigating through the object graph outside of the session facade (hence outside the hibernate session scope) you can get lazy initialization exceptions.
By using the command pattern, users can easily extend a command, appending the eager fetching to the command.
2) open ended session facade
A bunch of commands are reusable. But if you're writing a UI as a front end for the whole engine, you want to do fetch very specific things from the facade. In that case, it might be easier to have local command classes to the UI, instead of bloating a customized session with hundreds of methods for each individual use case.
That is the summary of the argumentation why i came to it. I certainly acknowledge that it has it's limitations. But I didn't yet see a better alternative. (that incl a quick but incomplete scan of the post you referenced)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132203#4132203
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4132203
More information about the jboss-dev-forums
mailing list