Home arrow BPM & Open Source arrow how to use
How to use the tk4jbpm Drucken

This page should give a short introduction how to use the tk4jbpm binaries in your own projects. For more information please read the gui tutotial too. For information on how to get the sources and contribute, refer to the project page please.

EJB 3 stuff 

The AdminBean can easily be deployed in an EJB3 application server (like JBoss 4.0.4 GA). The only dependency is that the JbpmConfiguration is bound to JNDI with the name "java:/jbpm/JbpmConfiguration".

In JBoss this can be done within the jboss-service.xml:

<?xml version="1.0" encoding="UTF-8"?> 						

<server>
<mbean code="org.jbpm.jmx.JbpmService"
name="jboss.jbpm:name=DefaultJbpm,service=JbpmService"
description="Default jBPM Service">
<attribute name="JndiName">java:/jbpm/JbpmConfiguration</attribute>
<depends>jboss.jca:service=DataSourceBinding,name=jbpmDS</depends>
</mbean>
</server>

After you have done this you just have to copy the ejb3 archive to your JBoss deploy directory, that's all.

If you want to use the Scheduler-MBean, which executes due timers, you can put the following MBean configuration in the same jboss-scheduler.xml:

   <!-- ==================================================================== -->
   <!-- Scheduler Service                                                    -->
   <!-- ==================================================================== -->

   <mbean code="org.jboss.varia.scheduler.Scheduler" name=":service=JbpmExecuteTimerScheduler">
      <attribute name="SchedulableClass">com.camunda.toolkit.jbpm.tools.jmx.JbossScheduler</attribute>
      <attribute name="SchedulableArgumentTypes">java.lang.String,java.lang.String</attribute>
      <attribute name="SchedulableArguments">@jbpm.scheduler.user@, @jbpm.scheduler.password@</attribute>
      <attribute name="InitialStartDate">0</attribute>
      <attribute name="SchedulePeriod">@jbpm.scheduler.period@</attribute>
      <attribute name="InitialRepetitions">@jbpm.scheduler.initialRepetitions@</attribute>
      <attribute name="StartAtStartup">@jbpm.scheduler.startAtStartup@</attribute>

      <!-- jbpm must be deployed before... -->
      <depends>jboss.j2ee:service=EJB3,name=com.camunda.toolkit.jbpm.service.AdminServicesImpl</depends>
  </mbean>

Using this scheduler is not the onl yoption to get schedulingin a ejb 3 environment to work. Other options are the ejb 3 timer service or some other scheduling framework.

Admin Client 

The Admin-Client can also be easily included in a Swing client. The following code initializes the AdminServices to use the deployed bean on the application server configured in your local jndi.properties:

CommandService commandService = (CommandService) new InitialContext().lookup("/jmgui/CommandServiceBean/remote");
Tk4jbpmConfiguration.initTk4jbpm(commandService, "/tk4jbpm.xml", false);
JbpmAdminPanel.getInstance().showMdiClient();

User Client Framework 

please read the gui tutorial and the JavaMagazin article (available on the publications site).