private static final Logger LOG = Logger.getLogger(JenkowEngine.class.getName());
private static ProcessEngine engine;
public static ProcessEngine getEngine(){
if (engine == null){
Database ec = JenkowBuilder.descriptor().getDatabase();
LOG.info("engineConfig="+ec);
ProcessEngineConfiguration cfg;
// context for *all* processes. available in exppressions and scripts in the process.
Map<Object,Object> ctxBeans = new HashMap<Object,Object>();
ctxBeans.put("log",LOG);
if (ec instanceof H2DemoDatabase) {
cfg = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
// we will be sharing this database with Activiti Explorer, so don't force re-creation of the whole DB
// and honor what's already there
cfg.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
} else {
cfg = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
Mailer.DescriptorImpl md = Mailer.descriptor();
System.out.println("mailer config");
System.out.println("md.getSmtpServer() -> "+md.getSmtpServer());
System.out.println("md.getDefaultSuffix() -> "+md.getDefaultSuffix());
System.out.println("md.getReplyToAddress() -> "+md.getReplyToAddress());
System.out.println("md.getSmtpPort() -> "+md.getSmtpPort());
// set database config
try {
cfg.setDataSource(ec.getDataSource());
} catch (SQLException e) {
throw new Error(e); // TODO: what's the error handling strategy in this method?
}
// set other engine config