Revision 6892d459
Added by Andreas Müller about 7 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmModelCacher.java | ||
---|---|---|
30 | 30 |
import org.osgi.framework.Bundle; |
31 | 31 |
|
32 | 32 |
|
33 |
/** |
|
34 |
* This class serializing and deserializing the CDM model for performance purposes. |
|
35 |
* To serialize it see the comments on {@link #main(String[])} and on |
|
36 |
* https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions |
|
37 |
* |
|
38 |
* @author c.mathew |
|
39 |
* @date 2015 |
|
40 |
* |
|
41 |
*/ |
|
33 | 42 |
public class CdmModelCacher { |
34 | 43 |
|
35 | 44 |
|
36 |
|
|
37 |
|
|
38 | 45 |
public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml"; |
39 | 46 |
|
40 | 47 |
public static final String CDM_MAP_SER_FILE_PATH = "resources/cdm.map.ser"; |
... | ... | |
62 | 69 |
|
63 | 70 |
FileInputStream fin = new FileInputStream(modelMapFilePath); |
64 | 71 |
ObjectInputStream ois = new ObjectInputStream(fin); |
65 |
Map<String, CdmModelFieldPropertyFromClass> modelClassMap = (Map<String, CdmModelFieldPropertyFromClass>) ois.readObject(); |
|
72 |
@SuppressWarnings("unchecked") |
|
73 |
Map<String, CdmModelFieldPropertyFromClass> modelClassMap = (Map<String, CdmModelFieldPropertyFromClass>) ois.readObject(); |
|
66 | 74 |
ois.close(); |
67 | 75 |
return modelClassMap; |
68 | 76 |
} |
... | ... | |
143 | 151 |
// To re-create the serialised cdm map run, |
144 | 152 |
// mvn exec:java -Dexec.mainClass="eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher" |
145 | 153 |
// in the eu.etaxonomy.taxeditor.cdmlib project root dir |
154 |
// See also https://dev.e-taxonomy.eu/redmine/projects/edit/wiki/TaxonomicEditorDevelopersGuide#Model-Change-Actions |
|
155 |
//Note AM: does not fully work for me, but running the main from the IDE works. |
|
146 | 156 |
String CDM_MAP_SER_DIR = "resources/"; |
147 | 157 |
|
148 | 158 |
CdmModelCacher cdmModelCacher = new CdmModelCacher(); |
Also available in: Unified diff
ref #6360 and ref #6369 update cached model in taxeditor