Revision 703e8efc
Added by Cherian Mathew about 9 years ago
.gitattributes | ||
---|---|---|
359 | 359 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySession.java -text |
360 | 360 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionEnabled.java -text |
361 | 361 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManager.java -text |
362 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManagerObserver.java -text |
|
362 | 363 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySession.java -text |
363 | 364 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySessionManager.java -text |
364 | 365 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java -text |
... | ... | |
1372 | 1373 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostOperation.java -text |
1373 | 1374 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/AbstractPostTaxonOperation.java -text |
1374 | 1375 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/operation/IPostOperationEnabled.java -text |
1375 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/MatchStrategyConfigurator.java -text |
|
1376 | 1376 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java -text |
1377 | 1377 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferences.java -text |
1378 | 1378 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java -text |
... | ... | |
1813 | 1813 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewPart.java -text |
1814 | 1814 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java -text |
1815 | 1815 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/reporting/ReportingViewPart.java -text |
1816 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java -text |
|
1816 | 1817 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java -text |
1817 | 1818 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionController.java -text |
1818 | 1819 |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java -text |
eu.etaxonomy.taxeditor.cdmlib/META-INF/MANIFEST.MF | ||
---|---|---|
193 | 193 |
junit.framework;uses:="org.junit.runner.manipulation,org.junit.runner,org.junit.runner.notification", |
194 | 194 |
net.sf.ehcache, |
195 | 195 |
net.sf.ehcache.config, |
196 |
net.sf.ehcache.statistics, |
|
196 | 197 |
net.sf.ehcache.store, |
197 | 198 |
net.sf.json;uses:="net.sf.json.processors,net.sf.json.util,org.apache.commons.lang.exception", |
198 | 199 |
org.apache.commons.collections;uses:="org.apache.commons.collections.keyvalue,new org.apache.commons.collections", |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmRemoteCacheManager.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.remoting.cache; |
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 |
import java.io.IOException; |
|
5 | 4 |
import java.io.InputStream; |
6 | 5 |
|
7 | 6 |
import net.sf.ehcache.Cache; |
... | ... | |
10 | 9 |
|
11 | 10 |
import org.springframework.core.io.ClassPathResource; |
12 | 11 |
import org.springframework.core.io.Resource; |
13 |
import org.springframework.stereotype.Component; |
|
14 | 12 |
|
15 | 13 |
import eu.etaxonomy.cdm.common.CdmUtils; |
16 | 14 |
|
17 | 15 |
|
18 |
public class CdmRemoteCacheManager {
|
|
19 |
|
|
16 |
public class CdmRemoteCacheManager { |
|
17 |
|
|
20 | 18 |
private CacheManager cdmlibModelCacheManager; |
21 |
|
|
19 |
|
|
22 | 20 |
private static CdmRemoteCacheManager cdmRemoteCacheManager = null; |
23 |
|
|
21 |
|
|
24 | 22 |
public static final Resource CDMLIB_CACHE_MANAGER_CONFIG_RESOURCE = |
25 | 23 |
new ClassPathResource("cdmlib-ehcache.xml"); |
26 |
|
|
27 |
|
|
24 |
|
|
25 |
public static final String CDM_MODEL_CACHE_NAME = "cdmModelGetMethodsCache"; |
|
26 |
|
|
27 |
|
|
28 | 28 |
public enum CdmCacheManagerType { |
29 | 29 |
CDMLIB_MODEL, |
30 | 30 |
DEFAULT |
31 | 31 |
} |
32 | 32 |
|
33 | 33 |
public static CdmRemoteCacheManager getInstance(){ |
34 |
if(cdmRemoteCacheManager == null) {
|
|
35 |
cdmRemoteCacheManager = new CdmRemoteCacheManager();
|
|
34 |
if(cdmRemoteCacheManager == null) { |
|
35 |
cdmRemoteCacheManager = new CdmRemoteCacheManager(); |
|
36 | 36 |
} |
37 | 37 |
return cdmRemoteCacheManager; |
38 | 38 |
} |
39 | 39 |
private CdmRemoteCacheManager() { |
40 |
|
|
41 |
System.setProperty("ehcache.disk.store.dir", CdmUtils.getCdmHomeDir().getAbsolutePath() + File.separator + "cdmlib-model");
|
|
40 |
|
|
41 |
System.setProperty("ehcache.disk.store.dir", CdmUtils.getCdmHomeDir().getAbsolutePath() + File.separator + "cdmlib-model"); |
|
42 | 42 |
try { |
43 |
// NOTE:Programmatically creating the cache manager may solve the problem of
|
|
43 |
// NOTE:Programmatically creating the cache manager may solve the problem of |
|
44 | 44 |
// recreating data written to disk on startup |
45 | 45 |
// see https://stackoverflow.com/questions/1729605/ehcache-persist-to-disk-issues |
46 | 46 |
//String cacheFilePath = CDMLIB_CACHE_MANAGER_CONFIG_RESOURCE.getFile().getAbsolutePath(); |
47 | 47 |
InputStream in = this.getClass().getClassLoader().getResourceAsStream("cdmlib-ehcache.xml"); |
48 | 48 |
cdmlibModelCacheManager = new CacheManager(in); |
49 |
|
|
49 |
|
|
50 | 50 |
} catch (CacheException e) { |
51 | 51 |
throw new CdmClientCacheException(e); |
52 | 52 |
} |
... | ... | |
54 | 54 |
// throw new CdmClientCacheException(e); |
55 | 55 |
// } |
56 | 56 |
} |
57 |
|
|
57 |
|
|
58 | 58 |
public Cache getCdmModelGetMethodsCache(){ |
59 |
return cdmlibModelCacheManager.getCache("cdmModelGetMethodsCache"); |
|
59 |
return cdmlibModelCacheManager.getCache(CDM_MODEL_CACHE_NAME); |
|
60 |
} |
|
61 |
|
|
62 |
public CacheManager getCdmModelGetMethodsCacheManager() { |
|
63 |
return cdmlibModelCacheManager; |
|
64 |
} |
|
65 |
|
|
66 |
public CacheManager getDefaultCacheManager() { |
|
67 |
return CacheManager.create(); |
|
60 | 68 |
} |
61 |
|
|
69 |
|
|
62 | 70 |
public void shutdown(CdmCacheManagerType ccmt) { |
63 | 71 |
CacheManager cm; |
64 |
switch(ccmt) {
|
|
65 |
case CDMLIB_MODEL:
|
|
72 |
switch(ccmt) { |
|
73 |
case CDMLIB_MODEL: |
|
66 | 74 |
cdmlibModelCacheManager.shutdown(); |
67 | 75 |
break; |
68 | 76 |
case DEFAULT: |
... | ... | |
71 | 79 |
break; |
72 | 80 |
default: |
73 | 81 |
//do nothing |
74 |
}
|
|
82 |
} |
|
75 | 83 |
} |
76 |
|
|
84 |
|
|
77 | 85 |
public static void checkCacheProperties() { |
78 | 86 |
String pathToCache = System.getProperty("ehcache.disk.store.dir"); |
79 | 87 |
if(pathToCache == null || pathToCache.isEmpty()) { |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java | ||
---|---|---|
12 | 12 |
import java.lang.reflect.Field; |
13 | 13 |
import java.util.ArrayList; |
14 | 14 |
import java.util.Collection; |
15 |
import java.util.HashMap; |
|
15 | 16 |
import java.util.HashSet; |
16 | 17 |
import java.util.Iterator; |
17 | 18 |
import java.util.List; |
18 | 19 |
import java.util.Map; |
19 | 20 |
import java.util.Set; |
21 |
import java.util.TreeMap; |
|
22 |
import java.util.TreeSet; |
|
20 | 23 |
|
21 | 24 |
import javassist.util.proxy.ProxyFactory; |
22 | 25 |
import net.sf.ehcache.Cache; |
23 | 26 |
import net.sf.ehcache.Element; |
24 | 27 |
import net.sf.ehcache.config.CacheConfiguration; |
28 |
import net.sf.ehcache.config.SizeOfPolicyConfiguration; |
|
29 |
import net.sf.ehcache.statistics.LiveCacheStatistics; |
|
25 | 30 |
import net.sf.ehcache.store.MemoryStoreEvictionPolicy; |
26 | 31 |
|
27 | 32 |
import org.apache.log4j.Logger; |
33 |
import org.hibernate.collection.internal.PersistentList; |
|
34 |
import org.hibernate.collection.internal.PersistentMap; |
|
35 |
import org.hibernate.collection.internal.PersistentSet; |
|
36 |
import org.hibernate.collection.internal.PersistentSortedMap; |
|
37 |
import org.hibernate.collection.internal.PersistentSortedSet; |
|
28 | 38 |
import org.hibernate.collection.spi.PersistentCollection; |
29 | 39 |
import org.hibernate.proxy.HibernateProxy; |
30 | 40 |
import org.hibernate.proxy.LazyInitializer; |
... | ... | |
32 | 42 |
|
33 | 43 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher; |
34 | 44 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
45 |
import eu.etaxonomy.cdm.model.common.PersistentMultiLanguageText; |
|
46 |
import eu.etaxonomy.taxeditor.remoting.CdmRemotingException; |
|
35 | 47 |
import eu.etaxonomy.taxeditor.remoting.cache.EntityCacherDebugResult.CdmEntityInfo; |
36 | 48 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; |
37 | 49 |
|
... | ... | |
90 | 102 |
cdmlibModelCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache(); |
91 | 103 |
this.cdmEntitySessionManager = cdmEntitySessionManager; |
92 | 104 |
|
105 |
|
|
93 | 106 |
} |
94 | 107 |
|
95 | 108 |
public CdmTransientEntityCacher(Object obj, ICdmEntitySessionManager cdmEntitySessionManager) { |
... | ... | |
102 | 115 |
* @return |
103 | 116 |
*/ |
104 | 117 |
private CacheConfiguration getEntityCacheConfiguration(String cacheId) { |
118 |
SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration(); |
|
119 |
sizeOfConfig.setMaxDepth(10000); |
|
120 |
sizeOfConfig.setMaxDepthExceededBehavior("abort"); |
|
105 | 121 |
// For a better understanding on how to size caches, refer to |
106 | 122 |
// http://ehcache.org/documentation/configuration/cache-size |
107 | 123 |
return new CacheConfiguration(cacheId, 500) |
108 | 124 |
.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU) |
109 |
.eternal(false)
|
|
125 |
//.eternal(true);
|
|
110 | 126 |
// default ttl and tti set to 2 hours |
111 | 127 |
.timeToLiveSeconds(60*60*2) |
112 |
.timeToIdleSeconds(60*60*2); |
|
128 |
.timeToIdleSeconds(60*60*2) |
|
129 |
.statistics(true) |
|
130 |
.sizeOfPolicy(sizeOfConfig); |
|
131 |
|
|
132 |
|
|
113 | 133 |
|
114 | 134 |
} |
115 | 135 |
|
... | ... | |
117 | 137 |
cdmServiceCacher = css; |
118 | 138 |
} |
119 | 139 |
|
140 |
public LiveCacheStatistics getCacheStatistics() { |
|
141 |
return cache.getLiveCacheStatistics(); |
|
142 |
} |
|
143 |
|
|
120 | 144 |
/** |
121 | 145 |
* Returns the cache corresponding to the cache id |
122 | 146 |
* |
... | ... | |
387 | 411 |
} |
388 | 412 |
} |
389 | 413 |
|
414 |
if(o != null && o instanceof PersistentCollection) { |
|
415 |
PersistentCollection pc = ((PersistentCollection)o); |
|
416 |
if(pc.wasInitialized()) { |
|
417 |
o = getObject(pc); |
|
418 |
field.set(cdmEntity, o); |
|
419 |
} |
|
420 |
} |
|
421 |
|
|
390 | 422 |
//field.set(cdmEntity, o); |
391 | 423 |
CdmBase cdmEntityInSubGraph = null; |
392 | 424 |
if(o != null |
... | ... | |
401 | 433 |
// up-to-date by setting to the value of the cdm entity being loaded |
402 | 434 |
// the only execption to this is found below |
403 | 435 |
field.set(cachedCdmEntity, o); |
436 |
|
|
404 | 437 |
// the only exception to updating the field to the latest value |
405 | 438 |
// is the case where the field has been already initialised, cached and |
406 | 439 |
// is not the same as the one in the cache, in which case we set the value |
... | ... | |
518 | 551 |
public void dispose() { |
519 | 552 |
cache.removeAll(); |
520 | 553 |
cache.flush(); |
521 |
|
|
554 |
cdmServiceCacher.getDefaultCacheManager().removeCache(cacheId); |
|
522 | 555 |
} |
523 | 556 |
|
524 | 557 |
|
... | ... | |
584 | 617 |
if(obj instanceof CdmBase) { |
585 | 618 |
return (T) debugRecursive((CdmBase)obj, alreadyVisitedEntities, entityCacherDebugResult); |
586 | 619 |
} else if (obj instanceof Map) { |
587 |
return (T) debugRecursive((Map<T,T>)obj, alreadyVisitedEntities, entityCacherDebugResult);
|
|
620 |
return (T) debug((Map<T,T>)obj, alreadyVisitedEntities, entityCacherDebugResult); |
|
588 | 621 |
} else if (obj instanceof Collection) { |
589 |
return (T) debugRecursive((Collection<T>)obj, alreadyVisitedEntities, entityCacherDebugResult);
|
|
622 |
return (T) debug((Collection<T>)obj, alreadyVisitedEntities, entityCacherDebugResult); |
|
590 | 623 |
} |
591 | 624 |
|
592 | 625 |
logger.info("No caching yet for type " + obj.getClass().getName()); |
... | ... | |
653 | 686 |
|
654 | 687 |
private CdmBase debugRecursive(CdmBase cdmEntity, Set<CdmBase> alreadyVisitedEntities, EntityCacherDebugResult entityCacherDebugResult) { |
655 | 688 |
|
656 |
CdmBase cachedCdmEntity = debug(cdmEntity); |
|
689 |
|
|
657 | 690 |
|
658 | 691 |
// we want to recursive through the cdmEntity (and not the cachedCdmEntity) |
659 | 692 |
// since there could be new or deleted objects in the cdmEntity sub-graph |
... | ... | |
669 | 702 |
// this object will be either a CdmBase or a Collection / Map |
670 | 703 |
// with CdmBase as the generic type |
671 | 704 |
|
672 |
CdmBase cdmEntityInSubGraph = getDebugCdmBaseTypeFieldValue(cdmEntity, cachedCdmEntity, field, alreadyVisitedEntities, entityCacherDebugResult);
|
|
705 |
CdmBase cdmEntityInSubGraph = getDebugCdmBaseTypeFieldValue(cdmEntity, field, alreadyVisitedEntities, entityCacherDebugResult); |
|
673 | 706 |
if(cdmEntityInSubGraph != null) { |
674 | 707 |
if(!alreadyVisitedEntities.contains(cdmEntityInSubGraph)) { |
675 | 708 |
logger.info("recursive debugging object of type " + cdmEntityInSubGraph.getClass().getName() + " with id " + cdmEntityInSubGraph.getId()); |
... | ... | |
683 | 716 |
throw new CdmClientCacheException("CdmEntity with class " + cdmEntity.getClass().getName() + " is not found in the cdmlib model cache. " + |
684 | 717 |
"The cache may be corrupted or not in sync with the latest model version" ); |
685 | 718 |
} |
686 |
return cachedCdmEntity;
|
|
719 |
return cdmEntity; |
|
687 | 720 |
} |
688 | 721 |
|
689 | 722 |
|
690 | 723 |
private CdmBase getDebugCdmBaseTypeFieldValue(CdmBase cdmEntity, |
691 |
CdmBase cachedCdmEntity, |
|
692 | 724 |
String fieldName, |
693 | 725 |
Set<CdmBase> alreadyVisitedEntities, |
694 | 726 |
EntityCacherDebugResult entityCacherDebugResult) { |
695 | 727 |
|
696 |
// this method attempts to make sure that for any two objects found in |
|
697 |
// the object graph, if they are equal then they should also be the same, |
|
698 |
// which is crucial for the merge to work |
|
699 |
if(cachedCdmEntity == null) { |
|
700 |
throw new CdmClientCacheException("When trying to set field value, the cached cdm entity cannot be null"); |
|
701 |
} |
|
702 | 728 |
|
703 | 729 |
Class<?> clazz = cdmEntity.getClass(); |
704 | 730 |
try { |
... | ... | |
715 | 741 |
if(o != null && o instanceof HibernateProxy) { |
716 | 742 |
LazyInitializer hli = ((HibernateProxy)o).getHibernateLazyInitializer(); |
717 | 743 |
if(!hli.isUninitialized()) { |
718 |
o = ((HibernateProxy) o).getHibernateLazyInitializer().getImplementation(); |
|
744 |
o = hli.getImplementation(); |
|
745 |
} |
|
746 |
} |
|
747 |
|
|
748 |
if(o != null && o instanceof PersistentCollection) { |
|
749 |
PersistentCollection pc = ((PersistentCollection)o); |
|
750 |
if(pc.wasInitialized()) { |
|
751 |
o = getObject(pc); |
|
719 | 752 |
} |
720 | 753 |
} |
721 | 754 |
CdmBase cdmEntityInSubGraph = null; |
... | ... | |
726 | 759 |
if(CdmBase.class.isAssignableFrom(o.getClass())) { |
727 | 760 |
logger.info("found initialised cdm entity '" + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId()); |
728 | 761 |
cdmEntityInSubGraph = (CdmBase)o; |
762 |
for(CdmBase visitedEntity : alreadyVisitedEntities) { |
|
763 |
if(cdmEntityInSubGraph.equals(visitedEntity) && cdmEntityInSubGraph != visitedEntity) { |
|
764 |
//logger.info(" - found duplicate entity at " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId()); |
|
765 |
CdmEntityInfo cei = entityCacherDebugResult.new CdmEntityInfo(cdmEntityInSubGraph, cdmEntity, field); |
|
766 |
CdmEntityInfo dupCei = entityCacherDebugResult.new CdmEntityInfo(visitedEntity, null, field); |
|
767 |
entityCacherDebugResult.addDuplicateEntity(cei, dupCei); |
|
768 |
} |
|
769 |
} |
|
770 |
|
|
729 | 771 |
CdmBase cachedCdmEntityInSubGraph = getFromCache(cdmEntityInSubGraph); |
730 | 772 |
// the only exception to updating the field to the latest value |
731 | 773 |
// is the case where the field has been already initialised, cached and |
732 | 774 |
// is not the same as the one in the cache, in which case we set the value |
733 | 775 |
// of the field to the one found in the cache |
734 |
if(cachedCdmEntityInSubGraph != null) { |
|
735 |
if(cachedCdmEntityInSubGraph != cdmEntityInSubGraph) { |
|
736 |
logger.info(" - found duplicate entity at " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId()); |
|
737 |
CdmEntityInfo cei = entityCacherDebugResult.new CdmEntityInfo(cdmEntityInSubGraph, cdmEntity, field); |
|
738 |
CdmEntityInfo cachedCei = entityCacherDebugResult.new CdmEntityInfo(cachedCdmEntityInSubGraph, null, field); |
|
739 |
entityCacherDebugResult.addDuplicateEntity(cei, cachedCei); |
|
740 |
} |
|
741 |
} else { |
|
776 |
|
|
777 |
if(cachedCdmEntityInSubGraph == null) { |
|
742 | 778 |
// found a cdm entity which is not in cache - need to record this |
743 |
logger.info(" - found entity not in cache " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId()); |
|
779 |
//logger.info(" - found entity not in cache " + fieldName + "' in object of type " + clazz.getName() + " with id " + cdmEntity.getId());
|
|
744 | 780 |
CdmEntityInfo cei = entityCacherDebugResult.new CdmEntityInfo(cdmEntityInSubGraph, cdmEntity, field); |
745 | 781 |
entityCacherDebugResult.addEntityNotInCache(cei); |
746 | 782 |
} |
... | ... | |
763 | 799 |
} |
764 | 800 |
} |
765 | 801 |
|
802 |
public static Object getObject(PersistentCollection pc) { |
|
803 |
if(pc != null) { |
|
804 |
if(pc instanceof PersistentSet) { |
|
805 |
return new HashSet((Set)pc); |
|
806 |
} |
|
807 |
if(pc instanceof PersistentSortedSet) { |
|
808 |
return new TreeSet((Set)pc); |
|
809 |
} |
|
810 |
if(pc instanceof PersistentList) { |
|
811 |
return new ArrayList((List)pc); |
|
812 |
} |
|
813 |
if(pc instanceof PersistentMap || pc instanceof PersistentMultiLanguageText) { |
|
814 |
return new HashMap((Map)pc); |
|
815 |
} |
|
816 |
if(pc instanceof PersistentSortedMap) { |
|
817 |
return new TreeMap((Map)pc); |
|
818 |
} |
|
819 |
throw new CdmRemotingException("Cannot get Collection field for type " + pc.getClass().getName()); |
|
820 |
} |
|
821 |
return null; |
|
822 |
} |
|
766 | 823 |
|
767 | 824 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/EntityCacherDebugResult.java | ||
---|---|---|
61 | 61 |
CdmEntityInfo cachedCei = entry.getValue(); |
62 | 62 |
sb.append(" - entity : " + cei.getCb().getUserFriendlyTypeName() + "/" + cei.getCb().getId() + |
63 | 63 |
" as field " + cei.getField().getName() + |
64 |
" of entity" + cei.getCbOwner().getUserFriendlyTypeName() + "/" + cei.getCbOwner().getId()); |
|
64 |
" of entity " + cei.getCbOwner().getUserFriendlyTypeName() + "/" + cei.getCbOwner().getId());
|
|
65 | 65 |
sb.append(System.getProperty("line.separator")); |
66 |
sb.append(" - cached entity : " + cachedCei.getCb().getUserFriendlyTypeName() + "/" + cachedCei.getCb().getId() +
|
|
66 |
sb.append(" - duplicate entity : " + cachedCei.getCb().getUserFriendlyTypeName() + "/" + cachedCei.getCb().getId() +
|
|
67 | 67 |
" as field " + cachedCei.getField().getName()); |
68 |
sb.append(System.getProperty("line.separator")); |
|
68 | 69 |
sb.append("-----------"); |
69 | 70 |
} |
70 | 71 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySession.java | ||
---|---|---|
15 | 15 |
import java.util.Set; |
16 | 16 |
import java.util.UUID; |
17 | 17 |
|
18 |
import net.sf.ehcache.statistics.LiveCacheStatistics; |
|
19 |
|
|
20 |
import org.apache.log4j.Logger; |
|
18 | 21 |
import org.apache.poi.ss.formula.functions.T; |
19 | 22 |
|
20 | 23 |
import eu.etaxonomy.cdm.api.service.IService; |
... | ... | |
39 | 42 |
|
40 | 43 |
public class CdmEntitySession implements ICdmEntitySession { |
41 | 44 |
|
45 |
private static final Logger logger = Logger.getLogger(CdmEntitySession.class); |
|
42 | 46 |
|
43 | 47 |
private final CdmEntitySessionManager cdmEntitySessionManager; |
44 | 48 |
|
... | ... | |
151 | 155 |
|
152 | 156 |
@Override |
153 | 157 |
public void bind() { |
158 |
logger.info("Binding session with owner " + sessionOwner.toString()); |
|
154 | 159 |
cdmEntitySessionManager.bind(sessionOwner); |
160 |
cdmEntitySessionManager.notifyObservers(); |
|
155 | 161 |
} |
162 |
|
|
156 | 163 |
/* (non-Javadoc) |
157 | 164 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#dispose() |
158 | 165 |
*/ |
... | ... | |
164 | 171 |
CdmPostDataChangeObservableListener.getDefault().unregister(observer); |
165 | 172 |
} |
166 | 173 |
changeObservers.clear(); |
174 |
cdmEntitySessionManager.dispose(sessionOwner); |
|
167 | 175 |
} |
168 | 176 |
|
169 | 177 |
|
... | ... | |
233 | 241 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase) |
234 | 242 |
*/ |
235 | 243 |
@Override |
236 |
public <T extends CdmBase> void remoteUpdate(IService<T> service, T cdmBase) { |
|
237 |
service.merge(cdmBase); |
|
244 |
public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) { |
|
245 |
debug(cdmBase); |
|
246 |
T mergedCdmBase = service.merge(cdmBase); |
|
247 |
//cdmTransientEntityCacher.clear(); |
|
238 | 248 |
// FIXME:Remoting not really sure if we need to reload the new |
239 | 249 |
// merged object or can we keep using the old one |
240 | 250 |
//return load(mergedCdmBase); |
251 |
|
|
252 |
return mergedCdmBase; |
|
253 |
} |
|
254 |
|
|
255 |
|
|
256 |
/* (non-Javadoc) |
|
257 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#isActive() |
|
258 |
*/ |
|
259 |
@Override |
|
260 |
public boolean isActive() { |
|
261 |
return cdmEntitySessionManager.getActiveSession() == this; |
|
241 | 262 |
} |
242 | 263 |
|
243 | 264 |
|
265 |
/* (non-Javadoc) |
|
266 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getOwner() |
|
267 |
*/ |
|
268 |
@Override |
|
269 |
public ICdmEntitySessionEnabled getOwner() { |
|
270 |
return sessionOwner; |
|
271 |
} |
|
272 |
|
|
273 |
|
|
274 |
/* (non-Javadoc) |
|
275 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getNoOfObjectsInCache() |
|
276 |
*/ |
|
277 |
@Override |
|
278 |
public LiveCacheStatistics getCacheStatistics() { |
|
279 |
return cdmTransientEntityCacher.getCacheStatistics(); |
|
280 |
} |
|
281 |
|
|
282 |
|
|
283 |
|
|
284 |
|
|
244 | 285 |
|
245 | 286 |
|
246 | 287 |
|
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManager.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.session; |
11 | 11 |
|
12 |
import java.util.ArrayList; |
|
12 | 13 |
import java.util.Collection; |
13 | 14 |
import java.util.HashMap; |
15 |
import java.util.List; |
|
14 | 16 |
import java.util.Map; |
15 | 17 |
|
16 | 18 |
import org.apache.log4j.Logger; |
... | ... | |
27 | 29 |
public class CdmEntitySessionManager implements ICdmEntitySessionManager { |
28 | 30 |
private static final Logger logger = Logger.getLogger(CdmEntitySessionManager.class); |
29 | 31 |
|
30 |
private final Map<ICdmEntitySessionEnabled, CdmEntitySession> ownerSessionMap = |
|
31 |
new HashMap<ICdmEntitySessionEnabled, CdmEntitySession>(); |
|
32 |
private final Map<ICdmEntitySessionEnabled, ICdmEntitySession> ownerSessionMap = |
|
33 |
new HashMap<ICdmEntitySessionEnabled, ICdmEntitySession>(); |
|
34 |
|
|
35 |
private final List<ICdmEntitySessionManagerObserver> sessionObservers = new ArrayList<ICdmEntitySessionManagerObserver>(); |
|
32 | 36 |
|
33 | 37 |
private ICdmEntitySession activeSession; |
34 | 38 |
|
35 | 39 |
@Override |
36 | 40 |
public ICdmEntitySession newSession(ICdmEntitySessionEnabled sessionOwner, boolean setAsActive) { |
37 |
CdmEntitySession session = ownerSessionMap.get(sessionOwner); |
|
41 |
ICdmEntitySession session = ownerSessionMap.get(sessionOwner);
|
|
38 | 42 |
if(session == null) { |
39 | 43 |
session = new CdmEntitySession(sessionOwner, this); |
40 | 44 |
addToOwnerSessionMap(sessionOwner, session); |
45 |
|
|
41 | 46 |
} |
42 | 47 |
|
43 | 48 |
if(setAsActive) { |
44 | 49 |
activeSession = session; |
50 |
|
|
45 | 51 |
} |
52 |
|
|
46 | 53 |
return session; |
47 | 54 |
} |
48 | 55 |
|
49 | 56 |
@Override |
50 | 57 |
public ICdmEntitySession getActiveSession() { |
51 |
|
|
52 | 58 |
return activeSession; |
53 | 59 |
} |
54 | 60 |
|
61 |
|
|
62 |
/* (non-Javadoc) |
|
63 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getSessions() |
|
64 |
*/ |
|
65 |
@Override |
|
66 |
public Collection<ICdmEntitySession> getSessions() { |
|
67 |
return ownerSessionMap.values(); |
|
68 |
} |
|
69 |
|
|
70 |
|
|
55 | 71 |
/* (non-Javadoc) |
56 | 72 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#bind(eu.etaxonomy.taxeditor.session.ISessionEventListener) |
57 | 73 |
*/ |
... | ... | |
65 | 81 |
if(session == null) { |
66 | 82 |
session = newSession(sessionOwner,true); |
67 | 83 |
} |
84 |
|
|
68 | 85 |
activeSession = session; |
86 |
|
|
69 | 87 |
} |
70 | 88 |
|
71 | 89 |
|
... | ... | |
109 | 127 |
/* (non-Javadoc) |
110 | 128 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#dispose(eu.etaxonomy.taxeditor.session.ISessionEventListener) |
111 | 129 |
*/ |
112 |
@Override |
|
113 |
public void dispose(ICdmEntitySessionEnabled owner) { |
|
130 |
void dispose(ICdmEntitySessionEnabled owner) { |
|
114 | 131 |
ICdmEntitySession session = ownerSessionMap.get(owner); |
115 | 132 |
if(session == null) { |
116 | 133 |
logger.info("No Session connected to owner, nothing to dispose"); |
117 | 134 |
return; |
118 | 135 |
} |
119 |
session.dispose(); |
|
136 |
ownerSessionMap.remove(owner); |
|
137 |
notifyObservers(); |
|
120 | 138 |
} |
121 | 139 |
|
122 |
void addToOwnerSessionMap(ICdmEntitySessionEnabled owner, CdmEntitySession session) { |
|
140 |
void addToOwnerSessionMap(ICdmEntitySessionEnabled owner, ICdmEntitySession session) {
|
|
123 | 141 |
ownerSessionMap.put(owner, session); |
124 | 142 |
} |
125 | 143 |
|
144 |
/* (non-Javadoc) |
|
145 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#addSessionListener() |
|
146 |
*/ |
|
147 |
@Override |
|
148 |
public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver) { |
|
149 |
sessionObservers.add(sessionObserver); |
|
150 |
} |
|
151 |
|
|
152 |
public void notifyObservers() { |
|
153 |
for(ICdmEntitySessionManagerObserver sessionObserver : sessionObservers) { |
|
154 |
sessionObserver.changed(); |
|
155 |
} |
|
156 |
} |
|
157 |
|
|
158 |
/* (non-Javadoc) |
|
159 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#isRemoting() |
|
160 |
*/ |
|
161 |
@Override |
|
162 |
public boolean isRemoting() { |
|
163 |
// FIXME:Remoting stupid method to check whether we are in remoting |
|
164 |
return true; |
|
165 |
} |
|
166 |
|
|
167 |
|
|
168 |
|
|
169 |
|
|
126 | 170 |
|
127 | 171 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySession.java | ||
---|---|---|
5 | 5 |
import java.util.Set; |
6 | 6 |
import java.util.UUID; |
7 | 7 |
|
8 |
import net.sf.ehcache.statistics.LiveCacheStatistics; |
|
8 | 9 |
import eu.etaxonomy.cdm.api.service.IService; |
9 | 10 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
10 | 11 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
... | ... | |
13 | 14 |
|
14 | 15 |
public interface ICdmEntitySession { |
15 | 16 |
|
17 |
public ICdmEntitySessionEnabled getOwner(); |
|
18 |
|
|
19 |
public LiveCacheStatistics getCacheStatistics(); |
|
20 |
|
|
16 | 21 |
public <O extends Object> O load(O obj); |
17 | 22 |
|
18 | 23 |
public <T extends CdmBase> T load(T cdmBase); |
... | ... | |
41 | 46 |
|
42 | 47 |
public <T extends CdmBase> UUID remoteSave(IService<T> service, T cdmBase); |
43 | 48 |
|
44 |
public <T extends CdmBase> void remoteUpdate(IService<T> service, T cdmBase);
|
|
49 |
public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase);
|
|
45 | 50 |
|
46 | 51 |
|
47 | 52 |
|
... | ... | |
69 | 74 |
*/ |
70 | 75 |
public void fireNotifications(); |
71 | 76 |
|
77 |
public boolean isActive(); |
|
78 |
|
|
72 | 79 |
|
73 | 80 |
|
74 | 81 |
|
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManager.java | ||
---|---|---|
23 | 23 |
// public abstract <T extends CdmBase> Collection<T> load( |
24 | 24 |
// ISessionEventListener sessionOwner, Collection<T> cdmBaseList); |
25 | 25 |
|
26 |
public abstract <T extends CdmBase> Collection<T> load( |
|
27 |
Collection<T> cdmBaseList); |
|
26 |
public abstract <T extends CdmBase> Collection<T> load(Collection<T> cdmBaseList); |
|
28 | 27 |
|
29 |
public abstract void dispose(ICdmEntitySessionEnabled owner); |
|
28 |
//public abstract void dispose(ICdmEntitySessionEnabled owner);
|
|
30 | 29 |
|
31 | 30 |
/** |
32 | 31 |
* @return |
33 | 32 |
*/ |
34 | 33 |
public ICdmEntitySession getActiveSession(); |
35 | 34 |
|
35 |
public Collection<ICdmEntitySession> getSessions(); |
|
36 |
|
|
37 |
public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver); |
|
38 |
|
|
36 | 39 |
//FIXME:Remoting would be nice to have these methods working, |
37 | 40 |
// but they can only be useful if we can 'intelligently' |
38 | 41 |
// get from a model class to the correspoding service class |
... | ... | |
51 | 54 |
// public abstract void commit(IService service, CdmBase cdmBase); |
52 | 55 |
|
53 | 56 |
|
57 |
public boolean isRemoting(); |
|
58 |
|
|
54 | 59 |
|
55 | 60 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySessionManagerObserver.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.session; |
|
11 |
|
|
12 |
/** |
|
13 |
* @author cmathew |
|
14 |
* @date 16 Feb 2015 |
|
15 |
* |
|
16 |
*/ |
|
17 |
public interface ICdmEntitySessionManagerObserver { |
|
18 |
|
|
19 |
public void changed(); |
|
20 |
|
|
21 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySession.java | ||
---|---|---|
14 | 14 |
import java.util.Set; |
15 | 15 |
import java.util.UUID; |
16 | 16 |
|
17 |
import net.sf.ehcache.statistics.LiveCacheStatistics; |
|
17 | 18 |
import eu.etaxonomy.cdm.api.service.IService; |
18 | 19 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
19 | 20 |
import eu.etaxonomy.cdm.model.common.ICdmBase; |
... | ... | |
162 | 163 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#update(eu.etaxonomy.cdm.api.service.IService, eu.etaxonomy.cdm.model.common.CdmBase) |
163 | 164 |
*/ |
164 | 165 |
@Override |
165 |
public <T extends CdmBase> void remoteUpdate(IService<T> service, T cdmBase) {
|
|
166 |
|
|
166 |
public <T extends CdmBase> T remoteUpdate(IService<T> service, T cdmBase) {
|
|
167 |
return cdmBase; |
|
167 | 168 |
} |
168 | 169 |
|
169 | 170 |
|
... | ... | |
194 | 195 |
|
195 | 196 |
} |
196 | 197 |
|
198 |
/* (non-Javadoc) |
|
199 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getOwner() |
|
200 |
*/ |
|
201 |
@Override |
|
202 |
public ICdmEntitySessionEnabled getOwner() { |
|
203 |
return null; |
|
204 |
} |
|
205 |
|
|
206 |
/* (non-Javadoc) |
|
207 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#getCacheStatistics() |
|
208 |
*/ |
|
209 |
@Override |
|
210 |
public LiveCacheStatistics getCacheStatistics() { |
|
211 |
return null; |
|
212 |
} |
|
213 |
|
|
214 |
/* (non-Javadoc) |
|
215 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySession#isActive() |
|
216 |
*/ |
|
217 |
@Override |
|
218 |
public boolean isActive() { |
|
219 |
return false; |
|
220 |
} |
|
221 |
|
|
197 | 222 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/mock/MockCdmEntitySessionManager.java | ||
---|---|---|
6 | 6 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
7 | 7 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled; |
8 | 8 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; |
9 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver; |
|
9 | 10 |
|
10 | 11 |
|
11 | 12 |
public class MockCdmEntitySessionManager implements ICdmEntitySessionManager { |
... | ... | |
32 | 33 |
} |
33 | 34 |
|
34 | 35 |
|
35 |
@Override |
|
36 |
public void dispose(ICdmEntitySessionEnabled owner) { |
|
37 |
|
|
38 |
} |
|
39 |
|
|
40 | 36 |
/* (non-Javadoc) |
41 | 37 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#newSession(eu.etaxonomy.taxeditor.session.ISessionEventListener, boolean) |
42 | 38 |
*/ |
... | ... | |
53 | 49 |
return new MockCdmEntitySession(); |
54 | 50 |
} |
55 | 51 |
|
52 |
/* (non-Javadoc) |
|
53 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#getSessions() |
|
54 |
*/ |
|
55 |
@Override |
|
56 |
public Collection<ICdmEntitySession> getSessions() { |
|
57 |
return null; |
|
58 |
} |
|
59 |
|
|
60 |
/* (non-Javadoc) |
|
61 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#addSessionObserver(eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver) |
|
62 |
*/ |
|
63 |
@Override |
|
64 |
public void addSessionObserver(ICdmEntitySessionManagerObserver sessionObserver) { |
|
65 |
|
|
66 |
} |
|
67 |
|
|
68 |
/* (non-Javadoc) |
|
69 |
* @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#isRemoting() |
|
70 |
*/ |
|
71 |
@Override |
|
72 |
public boolean isRemoting() { |
|
73 |
return false; |
|
74 |
} |
|
75 |
|
|
56 | 76 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/cdmlib-ehcache.xml | ||
---|---|---|
1 | 1 |
<ehcache name="cdmlibModelCacheManager"> |
2 | 2 |
<diskStore path="ehcache.disk.store.dir/cdmlib" /> |
3 | 3 |
<cache name="cdmModelGetMethodsCache" maxElementsInMemory="1" maxElementsOnDisk="0" eternal="true" |
4 |
overflowToDisk="true" diskPersistent="true" memoryStoreEvictionPolicy="LRU"> |
|
4 |
overflowToDisk="true" diskPersistent="true" memoryStoreEvictionPolicy="LRU" statistics="true"> |
|
5 |
<sizeOfPolicy maxDepth="1000" maxDepthExceededBehavior="abort"/> |
|
5 | 6 |
</cache> |
6 | 7 |
</ehcache> |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/CdmEntitySessionInput.java | ||
---|---|---|
60 | 60 |
|
61 | 61 |
public abstract <T extends CdmBase> List<T> getRootEntities(); |
62 | 62 |
|
63 |
public <T extends CdmBase> void update() { |
|
64 |
List<T> rootEntities = getRootEntities(); |
|
65 |
if(rootEntities != null) { |
|
66 |
for(T cdmBase : rootEntities) { |
|
67 |
cdmEntitySession.remoteUpdate(getService(), cdmBase); |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
63 |
public abstract <T extends CdmBase> void update(); |
|
71 | 64 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java | ||
---|---|---|
456 | 456 |
public List<TaxonNode> getRootEntities() { |
457 | 457 |
return Arrays.asList(taxonNode); |
458 | 458 |
} |
459 |
|
|
460 |
|
|
461 |
/* (non-Javadoc) |
|
462 |
* @see eu.etaxonomy.taxeditor.editor.CdmEntitySessionInput#update() |
|
463 |
*/ |
|
464 |
@Override |
|
465 |
public <T extends CdmBase> void update() { |
|
466 |
taxonNode = getCdmEntitySession().remoteUpdate(service, taxonNode); |
|
467 |
} |
|
459 | 468 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/key/polytomous/PolytomousKeyEditorInput.java | ||
---|---|---|
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
public void dispose() { |
79 |
CdmStore.getCurrentSessionManager().dispose(this);
|
|
79 |
cdmEntitySession.dispose();
|
|
80 | 80 |
} |
81 | 81 |
|
82 | 82 |
|
eu.etaxonomy.taxeditor.store/plugin.xml | ||
---|---|---|
263 | 263 |
id="eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView" |
264 | 264 |
name="%view.name.6" |
265 | 265 |
restorable="true"> |
266 |
</view> |
|
267 |
<view |
|
268 |
allowMultiple="false" |
|
269 |
class="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart" |
|
270 |
id="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart" |
|
271 |
name="Sessions" |
|
272 |
restorable="false"> |
|
266 | 273 |
</view> |
267 | 274 |
</extension> |
268 | 275 |
<extension |
... | ... | |
361 | 368 |
</reference> |
362 | 369 |
</visibleWhen> |
363 | 370 |
</command> |
371 |
<command |
|
372 |
commandId="org.eclipse.ui.views.showView" |
|
373 |
label="Sessions" |
|
374 |
style="push"> |
|
375 |
<parameter |
|
376 |
name="org.eclipse.ui.views.showView.viewId" |
|
377 |
value="eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"> |
|
378 |
</parameter> |
|
379 |
</command> |
|
364 | 380 |
</menu> |
365 | 381 |
</menuContribution> |
366 | 382 |
<menuContribution |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/MatchStrategyConfigurator.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2007 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
|
|
11 |
package eu.etaxonomy.taxeditor.parser; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
|
14 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
|
15 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
16 |
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy; |
|
17 |
import eu.etaxonomy.cdm.strategy.match.MatchException; |
|
18 |
import eu.etaxonomy.cdm.strategy.match.MatchMode; |
|
19 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
20 |
|
|
21 |
/** |
|
22 |
* This class defines the MatchStrategies that will be used by the ParseHandler. |
|
23 |
* |
|
24 |
* @author n.hoffmann |
|
25 |
* @created Jan 22, 2010 |
|
26 |
* @version 1.0 |
|
27 |
*/ |
|
28 |
public class MatchStrategyConfigurator { |
|
29 |
|
|
30 |
/** |
|
31 |
* <p>NonViralNameMatchStrategy</p> |
|
32 |
* |
|
33 |
* @throws eu.etaxonomy.cdm.strategy.match.MatchException if any. |
|
34 |
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object. |
|
35 |
*/ |
|
36 |
public static IMatchStrategy NonViralNameMatchStrategy() throws MatchException{ |
|
37 |
return getDefaultNonViralNameMatchStrategy();// PreferencesUtil.getMatchStrategy(NonViralName.class); |
|
38 |
} |
|
39 |
|
|
40 |
/** |
|
41 |
* <p>TeamOrPersonMatchStrategy</p> |
|
42 |
* |
|
43 |
* @throws eu.etaxonomy.cdm.strategy.match.MatchException if any. |
|
44 |
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object. |
|
45 |
*/ |
|
46 |
public static IMatchStrategy TeamOrPersonMatchStrategy() throws MatchException{ |
|
47 |
return null;// PreferencesUtil.getMatchStrategy(TeamOrPersonBase.class); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* <p>ReferenceMatchStrategy</p> |
|
52 |
* |
|
53 |
* @throws eu.etaxonomy.cdm.strategy.match.MatchException if any. |
|
54 |
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object. |
|
55 |
*/ |
|
56 |
public static IMatchStrategy ReferenceMatchStrategy() throws MatchException{ |
|
57 |
return getDefaultReferenceMatchStrategy();// PreferencesUtil.getMatchStrategy(ReferenceBase.class); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* <p>getDefaultNonViralNameMatchStrategy</p> |
|
62 |
* |
|
63 |
* @throws eu.etaxonomy.cdm.strategy.match.MatchException if any. |
|
64 |
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object. |
|
65 |
*/ |
|
66 |
public static IMatchStrategy getDefaultNonViralNameMatchStrategy() throws MatchException{ |
|
67 |
IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(NonViralName.class); |
|
68 |
|
|
69 |
strategy.setMatchMode("nomenclaturalReference", MatchMode.IGNORE); |
|
70 |
strategy.setMatchMode("combinationAuthorTeam", MatchMode.IGNORE); |
|
71 |
strategy.setMatchMode("exCombinationAuthorTeam", MatchMode.IGNORE); |
|
72 |
strategy.setMatchMode("basionymAuthorTeam", MatchMode.IGNORE); |
|
73 |
strategy.setMatchMode("exBasionymAuthorTeam", MatchMode.IGNORE); |
|
74 |
|
|
75 |
return strategy; |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* <p>getDefaultTeamOrPersonMatchStrategy</p> |
|
80 |
* |
|
81 |
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object. |
|
82 |
* @throws eu.etaxonomy.cdm.strategy.match.MatchException if any. |
|
83 |
*/ |
|
84 |
public static IMatchStrategy getDefaultTeamOrPersonMatchStrategy() throws MatchException{ |
|
85 |
IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(TeamOrPersonBase.class); |
|
86 |
|
|
87 |
return strategy; |
|
88 |
} |
|
89 |
|
|
90 |
|
|
91 |
/** |
|
92 |
* <p>getDefaultReferenceMatchStrategy</p> |
|
93 |
* |
|
94 |
* @return a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object. |
|
95 |
* @throws eu.etaxonomy.cdm.strategy.match.MatchException if any. |
|
96 |
*/ |
|
97 |
public static IMatchStrategy getDefaultReferenceMatchStrategy() throws MatchException{ |
|
98 |
IMatchStrategy strategy = PreferencesUtil.getDefaultMatchStrategy(Reference.class); |
|
99 |
|
|
100 |
strategy.setMatchMode("title", MatchMode.EQUAL); |
|
101 |
strategy.setMatchMode("inReference", MatchMode.IGNORE); |
|
102 |
|
|
103 |
return strategy; |
|
104 |
} |
|
105 |
|
|
106 |
/** |
|
107 |
* <p>setMatchStrategy</p> |
|
108 |
* |
|
109 |
* @param matchStrategy a {@link eu.etaxonomy.cdm.strategy.match.IMatchStrategy} object. |
|
110 |
*/ |
|
111 |
public static void setMatchStrategy(IMatchStrategy matchStrategy) { |
|
112 |
PreferencesUtil.setMatchStrategy(matchStrategy); |
|
113 |
} |
|
114 |
|
|
115 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/parser/ParseHandler.java | ||
---|---|---|
15 | 15 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
16 | 16 |
import eu.etaxonomy.cdm.model.reference.Reference; |
17 | 17 |
import eu.etaxonomy.cdm.strategy.match.MatchException; |
18 |
import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator.MatchStrategy; |
|
18 | 19 |
import eu.etaxonomy.cdm.strategy.parser.NonViralNameParserImpl; |
19 | 20 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
20 | 21 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
... | ... | |
302 | 303 |
return new ArrayList<INomenclaturalReference>(); |
303 | 304 |
} |
304 | 305 |
try{ |
305 |
return CdmStore.getService(ICommonService.class).findMatching(nomenclaturalReference, MatchStrategyConfigurator.ReferenceMatchStrategy());
|
|
306 |
return CdmStore.getService(ICommonService.class).findMatching(nomenclaturalReference, MatchStrategy.Reference);
|
|
306 | 307 |
}catch (MatchException e) { |
307 | 308 |
MessagingUtils.error(this.getClass(), "Error finding matching references", e); |
308 | 309 |
} |
... | ... | |
320 | 321 |
} |
321 | 322 |
|
322 | 323 |
try{ |
323 |
return CdmStore.getService(ICommonService.class).findMatching(authorTeam, MatchStrategyConfigurator.TeamOrPersonMatchStrategy());
|
|
324 |
return CdmStore.getService(ICommonService.class).findMatching(authorTeam, MatchStrategy.TeamOrPerson);
|
|
324 | 325 |
}catch (MatchException e) { |
325 | 326 |
MessagingUtils.error(this.getClass(), "Error finding matching authors", e); |
326 | 327 |
} |
... | ... | |
334 | 335 |
private List<TaxonNameBase> findMatchingLatinNames(TaxonNameBase taxonNameBase) { |
335 | 336 |
|
336 | 337 |
try { |
337 |
return CdmStore.getService(ICommonService.class).findMatching(taxonNameBase, MatchStrategyConfigurator.NonViralNameMatchStrategy());
|
|
338 |
return CdmStore.getService(ICommonService.class).findMatching(taxonNameBase, MatchStrategy.NonViralName);
|
|
338 | 339 |
|
339 | 340 |
} catch (MatchException e) { |
340 | 341 |
MessagingUtils.error(this.getClass(), "Error finding matching names", e); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/matching/AbstractMatchingPreferences.java | ||
---|---|---|
33 | 33 |
import eu.etaxonomy.cdm.strategy.match.MatchException; |
34 | 34 |
import eu.etaxonomy.cdm.strategy.match.MatchMode; |
35 | 35 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
36 |
import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator;
|
|
36 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
|
37 | 37 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
38 | 38 |
|
39 | 39 |
/** |
... | ... | |
208 | 208 |
/** {@inheritDoc} */ |
209 | 209 |
@Override |
210 | 210 |
protected void performApply() { |
211 |
MatchStrategyConfigurator.setMatchStrategy(matchStrategy);
|
|
211 |
PreferencesUtil.setMatchStrategy(matchStrategy);
|
|
212 | 212 |
super.performApply(); |
213 | 213 |
} |
214 | 214 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/matching/NonViralNameMatchingPreference.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
15 | 15 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
16 | 16 |
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy; |
17 | 17 |
import eu.etaxonomy.cdm.strategy.match.MatchException; |
18 |
import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator; |
|
18 | 19 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
19 |
import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator; |
|
20 | 20 |
|
21 | 21 |
/** |
22 | 22 |
* <p>NonViralNameMatchingPreference class.</p> |
... | ... | |
31 | 31 |
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) |
32 | 32 |
*/ |
33 | 33 |
/** {@inheritDoc} */ |
34 |
public void init(IWorkbench workbench) { |
|
34 |
@Override |
|
35 |
public void init(IWorkbench workbench) { |
|
35 | 36 |
clazz = NonViralName.class; |
36 |
|
|
37 |
|
|
37 | 38 |
try { |
38 | 39 |
matchStrategy = MatchStrategyConfigurator.NonViralNameMatchStrategy(); |
39 | 40 |
} catch (MatchException e) { |
... | ... | |
41 | 42 |
throw new RuntimeException(e); |
42 | 43 |
} |
43 | 44 |
} |
44 |
|
|
45 |
|
|
45 | 46 |
/* (non-Javadoc) |
46 | 47 |
* @see eu.etaxonomy.taxeditor.preference.matching.AbstractMatchingPreferences#getDefaultMatchStrategy() |
47 | 48 |
*/ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/matching/ReferenceMatchingPreference.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
15 | 15 |
import eu.etaxonomy.cdm.model.reference.Reference; |
16 | 16 |
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy; |
17 | 17 |
import eu.etaxonomy.cdm.strategy.match.MatchException; |
18 |
import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator; |
|
18 | 19 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
19 |
import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator; |
|
20 | 20 |
|
21 | 21 |
/** |
22 | 22 |
* <p>ReferenceMatchingPreference class.</p> |
... | ... | |
31 | 31 |
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) |
32 | 32 |
*/ |
33 | 33 |
/** {@inheritDoc} */ |
34 |
public void init(IWorkbench workbench) { |
|
34 |
@Override |
|
35 |
public void init(IWorkbench workbench) { |
|
35 | 36 |
clazz = Reference.class; |
36 |
|
|
37 |
|
|
37 | 38 |
try { |
38 | 39 |
matchStrategy = MatchStrategyConfigurator.ReferenceMatchStrategy(); |
39 | 40 |
} catch (MatchException e) { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/matching/TeamOrPersonMatchingPreference.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
15 | 15 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
16 | 16 |
import eu.etaxonomy.cdm.strategy.match.IMatchStrategy; |
17 | 17 |
import eu.etaxonomy.cdm.strategy.match.MatchException; |
18 |
import eu.etaxonomy.cdm.strategy.match.MatchStrategyConfigurator; |
|
18 | 19 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
19 |
import eu.etaxonomy.taxeditor.parser.MatchStrategyConfigurator; |
|
20 | 20 |
|
21 | 21 |
/** |
22 | 22 |
* <p>TeamOrPersonMatchingPreference class.</p> |
... | ... | |
32 | 32 |
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) |
33 | 33 |
*/ |
34 | 34 |
/** {@inheritDoc} */ |
35 |
public void init(IWorkbench workbench) { |
|
35 |
@Override |
|
36 |
public void init(IWorkbench workbench) { |
|
36 | 37 |
|
37 | 38 |
clazz = TeamOrPersonBase.class; |
38 |
|
|
39 |
|
|
39 | 40 |
try { |
40 | 41 |
matchStrategy = MatchStrategyConfigurator.TeamOrPersonMatchStrategy(); |
41 | 42 |
} catch (MatchException e) { |
42 | 43 |
MessagingUtils.error(this.getClass(), e); |
43 | 44 |
throw new RuntimeException(e); |
44 | 45 |
} |
45 |
}
|
|
46 |
} |
|
46 | 47 |
|
47 | 48 |
/* (non-Javadoc) |
48 | 49 |
* @see eu.etaxonomy.taxeditor.preference.matching.AbstractMatchingPreferences#getDefaultMatchStrategy() |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.view.sessions; |
|
11 |
|
|
12 |
import java.text.DecimalFormat; |
|
13 |
import java.util.Collection; |
|
14 |
|
|
15 |
import net.sf.ehcache.Cache; |
|
16 |
import net.sf.ehcache.statistics.LiveCacheStatistics; |
|
17 |
|
|
18 |
import org.eclipse.jface.action.IMenuManager; |
|
19 |
import org.eclipse.jface.action.IToolBarManager; |
|
20 |
import org.eclipse.swt.SWT; |
|
21 |
import org.eclipse.swt.events.SelectionAdapter; |
|
22 |
import org.eclipse.swt.events.SelectionEvent; |
|
23 |
import org.eclipse.swt.layout.GridData; |
|
24 |
import org.eclipse.swt.layout.GridLayout; |
|
25 |
import org.eclipse.swt.widgets.Button; |
|
26 |
import org.eclipse.swt.widgets.Composite; |
|
27 |
import org.eclipse.swt.widgets.Label; |
|
28 |
import org.eclipse.swt.widgets.Table; |
|
29 |
import org.eclipse.swt.widgets.TableColumn; |
|
30 |
import org.eclipse.swt.widgets.TableItem; |
|
31 |
import org.eclipse.swt.widgets.Text; |
|
32 |
import org.eclipse.ui.part.ViewPart; |
|
33 |
import org.eclipse.wb.swt.SWTResourceManager; |
|
34 |
|
|
35 |
import eu.etaxonomy.cdm.api.cache.CdmCacher; |
|
36 |
import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager; |
|
37 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
38 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; |
|
39 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver; |
|
40 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
41 |
|
|
42 |
/** |
|
43 |
* @author cmathew |
|
44 |
* @date 16 Feb 2015 |
|
45 |
* |
|
46 |
*/ |
|
47 |
public class SessionsViewPart extends ViewPart implements ICdmEntitySessionManagerObserver { |
|
48 |
|
|
49 |
public static final String ID = "eu.etaxonomy.taxeditor.view.sessions.SessionsViewPart"; //$NON-NLS-1$ |
|
50 |
private Table tableSessions; |
|
51 |
|
|
52 |
private final String[] titles = { "Owner", "In Memory", "On Disk"}; |
|
53 |
|
|
54 |
private final ICdmEntitySessionManager cdmEntitySessionManager; |
|
55 |
private Text txtNoOfSessions; |
|
56 |
private Text txtNoOfCaches; |
|
57 |
private Text txtDefaultInMemory; |
|
58 |
private Text txtCdmModelInMemory; |
|
59 |
private Text txtCdmModelOnDisk; |
|
60 |
private Text txtDefaultOnDisk; |
|
61 |
public SessionsViewPart() { |
|
62 |
this.cdmEntitySessionManager = CdmStore.getCurrentSessionManager(); |
|
63 |
if(cdmEntitySessionManager != null) { |
|
64 |
cdmEntitySessionManager.addSessionObserver(this); |
|
65 |
} |
|
66 |
} |
|
67 |
|
|
68 |
/** |
|
69 |
* Create contents of the view part. |
|
70 |
* @param parent |
|
71 |
*/ |
|
72 |
@Override |
|
73 |
public void createPartControl(Composite parent) { |
|
74 |
Composite container = new Composite(parent, SWT.NONE); |
|
75 |
container.setLayout(new GridLayout(6, false)); |
|
76 |
{ |
|
77 |
Label lblNoOfSessions = new Label(container, SWT.NONE); |
|
78 |
lblNoOfSessions.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
79 |
lblNoOfSessions.setAlignment(SWT.RIGHT); |
|
80 |
GridData gd_lblNoOfSessions = new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1); |
|
81 |
gd_lblNoOfSessions.widthHint = 115; |
|
82 |
gd_lblNoOfSessions.minimumHeight = 30; |
|
83 |
lblNoOfSessions.setLayoutData(gd_lblNoOfSessions); |
|
84 |
lblNoOfSessions.setText("No. of Sessions : "); |
|
85 |
} |
|
86 |
{ |
|
87 |
txtNoOfSessions = new Text(container, SWT.BORDER); |
|
88 |
txtNoOfSessions.setEditable(false); |
|
89 |
txtNoOfSessions.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); |
|
90 |
GridData gd_txtNoOfSessions = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
91 |
gd_txtNoOfSessions.widthHint = 50; |
|
92 |
txtNoOfSessions.setLayoutData(gd_txtNoOfSessions); |
|
93 |
} |
|
94 |
new Label(container, SWT.NONE); |
|
95 |
new Label(container, SWT.NONE); |
|
96 |
new Label(container, SWT.NONE); |
|
97 |
new Label(container, SWT.NONE); |
|
98 |
{ |
|
99 |
Label lblNoOfCaches = new Label(container, SWT.CENTER); |
|
100 |
lblNoOfCaches.setAlignment(SWT.RIGHT); |
|
101 |
lblNoOfCaches.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
102 |
GridData gd_lblNoOfCaches = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); |
|
103 |
gd_lblNoOfCaches.widthHint = 150; |
|
104 |
lblNoOfCaches.setLayoutData(gd_lblNoOfCaches); |
|
105 |
lblNoOfCaches.setText("No. of entity caches : "); |
|
106 |
} |
|
107 |
{ |
|
108 |
txtNoOfCaches = new Text(container, SWT.BORDER); |
|
109 |
txtNoOfCaches.setEditable(false); |
|
110 |
GridData gd_txtNoOfCaches = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
111 |
gd_txtNoOfCaches.widthHint = 50; |
|
112 |
txtNoOfCaches.setLayoutData(gd_txtNoOfCaches); |
|
113 |
} |
|
114 |
new Label(container, SWT.NONE); |
|
115 |
new Label(container, SWT.NONE); |
|
116 |
new Label(container, SWT.NONE); |
|
117 |
new Label(container, SWT.NONE); |
|
118 |
|
|
119 |
{ |
|
120 |
Label lblDefaultCache = new Label(container, SWT.CENTER); |
|
121 |
lblDefaultCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
122 |
lblDefaultCache.setText("Default Cache, "); |
|
123 |
lblDefaultCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
124 |
lblDefaultCache.setAlignment(SWT.RIGHT); |
|
125 |
} |
|
126 |
{ |
|
127 |
Label lblDefaultInMemory = new Label(container, SWT.CENTER); |
|
128 |
lblDefaultInMemory.setText("in Memory : "); |
|
129 |
lblDefaultInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
130 |
lblDefaultInMemory.setAlignment(SWT.RIGHT); |
|
131 |
lblDefaultInMemory.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
132 |
} |
|
133 |
{ |
|
134 |
txtDefaultInMemory = new Text(container, SWT.BORDER); |
|
135 |
txtDefaultInMemory.setEditable(false); |
|
136 |
GridData gd_txtDefaultInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
137 |
gd_txtDefaultInMemory.widthHint = 130; |
|
138 |
txtDefaultInMemory.setLayoutData(gd_txtDefaultInMemory); |
|
139 |
} |
|
140 |
{ |
|
141 |
Label lblDefaultOnDisk = new Label(container, SWT.CENTER); |
|
142 |
lblDefaultOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
143 |
lblDefaultOnDisk.setText("on Disk : "); |
|
144 |
lblDefaultOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
145 |
lblDefaultOnDisk.setAlignment(SWT.RIGHT); |
|
146 |
} |
|
147 |
{ |
|
148 |
txtDefaultOnDisk = new Text(container, SWT.BORDER); |
|
149 |
txtDefaultOnDisk.setEditable(false); |
|
150 |
txtDefaultOnDisk.setText(""); |
|
151 |
GridData gd_txtDefaultOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
152 |
gd_txtDefaultOnDisk.widthHint = 130; |
|
153 |
txtDefaultOnDisk.setLayoutData(gd_txtDefaultOnDisk); |
|
154 |
} |
|
155 |
new Label(container, SWT.NONE); |
|
156 |
{ |
|
157 |
Label lblCdmModelCache = new Label(container, SWT.CENTER); |
|
158 |
lblCdmModelCache.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
159 |
lblCdmModelCache.setText("CDM Model Cache, "); |
|
160 |
lblCdmModelCache.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
161 |
lblCdmModelCache.setAlignment(SWT.RIGHT); |
|
162 |
} |
|
163 |
{ |
|
164 |
Label lblCdmModelInMemory = new Label(container, SWT.CENTER); |
|
165 |
lblCdmModelInMemory.setText("in Memory : "); |
|
166 |
lblCdmModelInMemory.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
167 |
lblCdmModelInMemory.setAlignment(SWT.RIGHT); |
|
168 |
GridData gd_lblCdmModelInMemory = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); |
|
169 |
gd_lblCdmModelInMemory.widthHint = 86; |
|
170 |
lblCdmModelInMemory.setLayoutData(gd_lblCdmModelInMemory); |
|
171 |
} |
|
172 |
{ |
|
173 |
txtCdmModelInMemory = new Text(container, SWT.BORDER); |
|
174 |
txtCdmModelInMemory.setEditable(false); |
|
175 |
GridData gd_txtCdmModelInMemory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
176 |
gd_txtCdmModelInMemory.widthHint = 130; |
|
177 |
txtCdmModelInMemory.setLayoutData(gd_txtCdmModelInMemory); |
|
178 |
} |
|
179 |
{ |
|
180 |
Label lblCdmModelOnDisk = new Label(container, SWT.CENTER); |
|
181 |
lblCdmModelOnDisk.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
|
182 |
lblCdmModelOnDisk.setText("on Disk : "); |
|
183 |
lblCdmModelOnDisk.setFont(SWTResourceManager.getFont("Ubuntu", 10, SWT.NORMAL)); |
|
184 |
lblCdmModelOnDisk.setAlignment(SWT.RIGHT); |
|
185 |
} |
|
186 |
{ |
|
187 |
txtCdmModelOnDisk = new Text(container, SWT.BORDER); |
|
188 |
txtCdmModelOnDisk.setEditable(false); |
|
189 |
txtCdmModelOnDisk.setText(""); |
|
190 |
GridData gd_txtCdmModelOnDisk = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); |
|
191 |
gd_txtCdmModelOnDisk.widthHint = 130; |
|
192 |
txtCdmModelOnDisk.setLayoutData(gd_txtCdmModelOnDisk); |
|
193 |
} |
|
194 |
new Label(container, SWT.NONE); |
|
195 |
{ |
|
196 |
Button btnRefresh = new Button(container, SWT.NONE); |
|
197 |
btnRefresh.addSelectionListener(new SelectionAdapter() { |
|
198 |
@Override |
|
199 |
public void widgetSelected(SelectionEvent e) { |
|
200 |
changed(); |
|
201 |
} |
|
202 |
}); |
|
203 |
GridData gd_btnRefresh = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); |
|
204 |
gd_btnRefresh.widthHint = 100; |
|
205 |
btnRefresh.setLayoutData(gd_btnRefresh); |
|
206 |
btnRefresh.setText("Refresh"); |
|
207 |
} |
|
208 |
new Label(container, SWT.NONE); |
|
209 |
new Label(container, SWT.NONE); |
|
210 |
new Label(container, SWT.NONE); |
|
211 |
new Label(container, SWT.NONE); |
|
212 |
new Label(container, SWT.NONE); |
|
213 |
|
|
214 |
{ |
|
215 |
tableSessions = new Table(container, SWT.BORDER | SWT.FULL_SELECTION); |
|
216 |
tableSessions.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1)); |
|
217 |
tableSessions.setHeaderVisible(true); |
|
218 |
tableSessions.setLinesVisible(true); |
|
219 |
} |
|
220 |
new Label(container, SWT.NONE); |
|
221 |
|
|
222 |
createActions(); |
|
223 |
initializeToolBar(); |
|
224 |
initializeMenu(); |
|
225 |
} |
|
226 |
|
|
227 |
/** |
Also available in: Unified diff
CdmRemoteCacheManager : added cache getter methods
CdmTransientEntityCacher, CdmEntitySession, CdmEntitySessionManager, ICdmEntitySession, ICdmEntitySessionManager, ICdmEntitySessionManagerObserver, MockCdmEntitySession, MockCdmEntitySessionManager , eu.etaxonomy.taxeditor.cdmlib/src/main/resources/cdmlib-ehcache.xml : added statistics config , getter method for live stats and observer to update when sessions are bound and disposed
eu.etaxonomy.taxeditor.store/plugin.xml, SessionsViewPart : added new sessions debug view
MatchStrategyConfigurator : moved to cdmlib
ParseHandler, AbstractMatchingPreferences, NonViralNameMatchingPreference, ReferenceMatchingPreference, TeamOrPersonMatchingPreference : refactored after removal of MatchStrategyConfigurator replaced by enum MatchStrategy