cancel
Showing results for 
Search instead for 
Did you mean: 

How to replace the identity session with 5.0?

patobe
Champ in-the-making
Champ in-the-making
How to replace the identity session with 5.0?

With RC1 it was possible to do the following:


// Get session factories
Map<Class<?>, SessionFactory> sessionFactories = processEngineConfiguration.getSessionFactories();

// Replace the identity session
sessionFactories.put(IdentitySession.class,new CustomIdentitySessionFactory());

But with 5.0 it is not possible to get or set the sessions factories on the process engine configuration. Any leads on this would be helpful.

Regards
/Patrick Öberg
2 REPLIES 2

patobe
Champ in-the-making
Champ in-the-making
Some background to this issue… our business requirements restricts us to use existing datasources with existing users and roles and we are not using the spring framework.

However, after digging around in the source code I've come to the following working solution:

// Read configuration from file
StandaloneProcessEngineConfiguration standaloneProcessEngineConfiguration = (StandaloneProcessEngineConfiguration) StandaloneProcessEngineConfiguration
.createProcessEngineConfigurationFromInputStream(stream);

// Create custom factories list
List<SessionFactory> sessionFactories = new ArrayList<SessionFactory>();

// Add my custom identity session factory to custom factories list
sessionFactories.add(new MyCustomIdentitySessionFactory());

// Set session factories
standaloneProcessEngineConfiguration.setCustomSessionFactories(sessionFactories);

// Build process engine from processEngineConfiguration
processEngine = standaloneProcessEngineConfiguration.buildProcessEngine();
I think that some documentation regarding engine configuration and custom factories would be most helpful.
Regards/Patrick Öberg

tombaeyens
Champ in-the-making
Champ in-the-making
This is still not stable.  That's why we don't document it yet.  Once it is stable, we document it and then the configurable pieces go in the public api.