To make use of jbpm-kie-services in your system, you will need to provide some mbeans to satisfy all dependencies of the services. There are several mbeans that depend on actual scenarios.
Entity manager and entity manager factory
User group callback for human tasks
Identity provider to pass authenticated user information to the services
When running in JEE environment, like JBoss Application Server, the mbean should satisfy all requirements of the jbpm-kie-services:
public class EnvironmentProducer {
@PersistenceUnit(unitName = "org.jbpm.domain")
private EntityManagerFactory emf;
@Inject
@Selectable
private UserGroupCallback userGroupCallback;
@Produces
public EntityManagerFactory getEntityManagerFactory() {
return this.emf;
}
@Produces
@RequestScoped
public EntityManager getEntityManager() {
EntityManager em = emf.createEntityManager();
return em;
}
public void close(@Disposes EntityManager em) {
em.close();
}
@Produces
public UserGroupCallback produceSelectedUserGroupCalback() {
return userGroupCallback;
}
@Produces
public IdentityProvider produceIdentityProvider {
return new IdentityProvider() {
// implement IdentityProvider
};
}
}
public class EnvironmentProducer {
@PersistenceUnit(unitName = "org.jbpm.domain")
private EntityManagerFactory emf;
@Inject
@Selectable
private UserGroupCallback userGroupCallback;
@Produces
public EntityManagerFactory getEntityManagerFactory() {
return this.emf;
}
@Produces
@RequestScoped
public EntityManager getEntityManager() {
EntityManager em = emf.createEntityManager();
return em;
}
public void close(@Disposes EntityManager em) {
em.close();
}
@Produces
public UserGroupCallback produceSelectedUserGroupCalback() {
return userGroupCallback;
}
@Produces
public IdentityProvider produceIdentityProvider {
return new IdentityProvider() {
// implement IdentityProvider
};
}
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Then the deployments/business-central.war/WEB-INF/beans.xml file may be configured to change the current settings of the new usergroupcallback implementation:
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Note
org.jbpm.services.task.identity.JAASUserGroupCallbackImpl is just an example here to demonstrate the settings of the application server regardless of what it actually is (LDAP, DB, etc).