import org.osgi.framework.Bundle;
+/**
+ * This class serializing and deserializing the CDM model for performance purposes.
+ * To serialize it see the comments on {@link #main(String[])} and on
+ * https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions
+ *
+ * @author c.mathew
+ * @date 2015
+ *
+ */
public class CdmModelCacher {
-
-
public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml";
public static final String CDM_MAP_SER_FILE_PATH = "resources/cdm.map.ser";
FileInputStream fin = new FileInputStream(modelMapFilePath);
ObjectInputStream ois = new ObjectInputStream(fin);
- Map<String, CdmModelFieldPropertyFromClass> modelClassMap = (Map<String, CdmModelFieldPropertyFromClass>) ois.readObject();
+ @SuppressWarnings("unchecked")
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = (Map<String, CdmModelFieldPropertyFromClass>) ois.readObject();
ois.close();
return modelClassMap;
}
// To re-create the serialised cdm map run,
// mvn exec:java -Dexec.mainClass="eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher"
// in the eu.etaxonomy.taxeditor.cdmlib project root dir
+ // See also https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions
+ //Note AM: does not fully work for me, but running the main from the IDE works.
String CDM_MAP_SER_DIR = "resources/";
CdmModelCacher cdmModelCacher = new CdmModelCacher();
<property name="connection.release_mode">after_transaction</property>
+ <property name="hibernate.implicit_naming_strategy">org.hibernate.boot.model.naming.ImplicitNamingStrategyComponentPathImpl</property>
+
<!-- Connection Pooling -->
<!-- <property name="hibernate.connection.provider_class">org.hibernate.service.jdbc.connections.internal.C3P0ConnectionProvider</property> -->
- <property name="hibernate.connection.provider_class">org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl</property>
+<!-- <property name="hibernate.connection.provider_class">org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl</property> -->
+ <property name="hibernate.connection.provider_class">eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacherConnectionProvider</property>
+
<!--
Configuring the C3P0ConnectionProvider
========================================