/** * Add or replace an entry in the environment to generate. * * @param name * name of the entry * @param classToUse * implementation * @return previous declaration for this name */ public String setApplicationEntry(final String name, final Class< ? > classToUse) { String xml = getObjectDecl(name, classToUse); return setApplicationEntry(name, xml); }
/** * Add or replace an entry in the environment to generate. * * @param name * name of the entry * @param classToUse * implementation * @param fieldKeys * list of fields to set * @param refKeys * value to set to the fields * @return previous declaration for this name */ public String setApplicationEntry(final String name, final Class< ? > classToUse, String[] fieldKeys, String[] refKeys) { String xml = getObjectDeclWithFields(name, classToUse, fieldKeys, refKeys); return setApplicationEntry(name, xml); }
private void setRuntimeHibernateConf() { String hibernateConfigXml = ""; hibernateConfigXml += "<hibernate-configuration name='" + EnvConstants.CORE_HB_CONF_NAME + "' >\n"; hibernateConfigXml += defaultIndent + "<properties resource='hibernate-core.properties' />\n"; hibernateConfigXml += defaultIndent + "<mappings resource='bonita.mappings.hbm.xml' />\n"; hibernateConfigXml += defaultIndent + "<cache-configuration resource='bonita.cache.xml' usage='read-write' />\n"; hibernateConfigXml += "</hibernate-configuration>"; this.setApplicationEntry(EnvConstants.CORE_HB_CONF_NAME, hibernateConfigXml); this.setApplicationEntry(EnvConstants.CORE_HB_SESSION_FACTORY_NAME, "<hibernate-session-factory name='" + EnvConstants.CORE_HB_SESSION_FACTORY_NAME + "' configuration='" + EnvConstants.CORE_HB_CONF_NAME + "' />"); this.setBlockEntry(EnvConstants.CORE_HB_SESSION_NAME, "<hibernate-session name='" + EnvConstants.CORE_HB_SESSION_NAME + "' factory='" + EnvConstants.CORE_HB_SESSION_FACTORY_NAME + "' />"); this.setBlockEntry(EnvConstants.CORE_PERSISTENCESERVICE_NAME, "<" + EnvConstants.XPDL_PERSISTENCE_SERVICE + " name='" + EnvConstants.CORE_PERSISTENCESERVICE_NAME + "' session='" + EnvConstants.CORE_HB_SESSION_NAME + "'/>"); }
@SuppressWarnings("unchecked") public EnvGenerator() { applicationVariables = new HashMap<String, String>(); blockVariables = new HashMap<String, String>(); this.setAPIType(Context.AutoDetect); // Hibernate configuration for bonita core engine. setRuntimeHibernateConf(); // Command execution configuration String commandServiceConfigXml = "<command-service>\n"; commandServiceConfigXml += defaultIndent + "<retry-interceptor />\n"; commandServiceConfigXml += defaultIndent + "<environment-interceptor />\n"; commandServiceConfigXml += defaultIndent + "<standard-transaction-interceptor />\n"; commandServiceConfigXml += "</command-service>\n"; this.setApplicationEntry("command-service", commandServiceConfigXml); this.setApplicationEntry("job-executor", "<job-executor threads='1' auto-start='true' />"); this.setApplicationEntry("type-resolver", "<variable-types resource='bonita.type.resolver.xml' />"); this.setRepositoryType(DbRepository.class, "<arg><string value='" + EnvConstants.CORE_PERSISTENCESERVICE_NAME + "' /></arg>"); this.setBlockEntry("transaction", "<transaction />"); this.setJournalType(DbJournal.class, "<arg><string value='" + EnvConstants.CORE_PERSISTENCESERVICE_NAME + "' /></arg>"); this.setFinishedInstanceHandlerType(DeleteFinishedInstanceHandler.class, ArchiveFinishedInstanceHandler.class); this.setUndeployedPackageHandlerType(ArchiveUndeployedPackageHandler.class); this.setRecorderType(LoggerRecorder.class); this.setArchiverType(LoggerArchiver.class); this.setHistoryType(XMLHistory.class); this.setBlockEntry("timer_session", "<timer-session />"); this.setBlockEntry("job-session", "<job-db-session session='" + EnvConstants.CORE_HB_SESSION_NAME + "' />"); }