01.08.2012 Views

Using Osworkflow in your Application

Using Osworkflow in your Application

Using Osworkflow in your Application

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Us<strong>in</strong>g</strong> OSWorkfl ow <strong>in</strong> <strong>your</strong> <strong>Application</strong><br />

Remember that the Configuration <strong>in</strong>terface plays a coord<strong>in</strong>ation role between the<br />

WorkflowStore (which manages <strong>in</strong>stance data) and the WorkflowFactory (which<br />

loads the template defi nitions). So it's natural to see the two mandatory properties<br />

of the Spr<strong>in</strong>gConfiguration, a WorkflowStore and a WorkflowFactory. The two<br />

previous bean defi nitions are referenced us<strong>in</strong>g the ref element.<br />

Lastly, you must let Spr<strong>in</strong>g manage the Workflow implementation of <strong>your</strong> choice. In<br />

the follow<strong>in</strong>g code snippet, we will defi ne the BasicWorkflow implementation.<br />

<br />

<br />

<br />

<br />

<br />

Note that the bean defi nition is a prototype one, that is, a bean with the s<strong>in</strong>gleton<br />

attribute set to false. It is created every time <strong>your</strong> code calls the BeanFactory and<br />

requests the workflow bean. This is a very important concept for you to grasp:<br />

Spr<strong>in</strong>g creates only one <strong>in</strong>stance of each bean by default.<br />

The two JavaBean properties are the configuration (mandatory) and the<br />

typeresolver (optional).<br />

Lastly, we will add a Hibernate SessionFactory declaration to the XML:<br />

<br />

<br />

org.hsqldb.jdbcDriver<br />

<br />

<br />

jdbc:hsqldb:data/osworkflow<br />

<br />

<br />

sa<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

[ 88 ]

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

Saved successfully!

Ooh no, something went wrong!