Revision 25ba5d31
Added by Andreas Müller 5 months ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCachingProxy.java | ||
---|---|---|
57 | 57 |
|
58 | 58 |
private CacheLoader cacheLoader; |
59 | 59 |
|
60 |
//NOTE AM: this is currently not used |
|
60 | 61 |
@Autowired |
61 | 62 |
private ConfigFileUtil configFileUtil = null; |
62 | 63 |
|
64 |
public CdmServiceCachingProxy() { |
|
65 |
super(); |
|
66 |
} |
|
67 |
|
|
63 | 68 |
@Override |
64 | 69 |
protected void setup() { |
65 | 70 |
|
... | ... | |
67 | 72 |
|
68 | 73 |
DefinedTermBase.setCacher(this); |
69 | 74 |
CdmTransientEntityCacher.setPermanentCacher(this); |
70 |
//TermServiceRequestExecutor.setDefaultCacher(this); |
|
71 | 75 |
RemoteInvocationTermCacher.setDefaultCacher(this); |
72 | 76 |
|
73 | 77 |
cacheLoader = new CacheLoader(this); |
... | ... | |
96 | 100 |
|
97 | 101 |
EhCacheConfiguration cacheConfig = new EhCacheConfiguration(); |
98 | 102 |
cacheConfig.setDiskStoreConfiguration(diskStoreConfiguration); |
103 |
|
|
99 | 104 |
CacheManager cacheManager = cacheConfig.cacheManager(); |
100 | 105 |
setCacheManager(cacheManager); |
101 | 106 |
} |
... | ... | |
111 | 116 |
|
112 | 117 |
return new CacheConfiguration(DEFAULT_CACHE_NAME, 0) |
113 | 118 |
.eternal(true) |
114 |
.statistics(true) |
|
115 | 119 |
.sizeOfPolicy(sizeOfConfig) |
116 | 120 |
.overflowToOffHeap(false); |
117 | 121 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CachedCommonServiceImpl.java | ||
---|---|---|
13 | 13 |
|
14 | 14 |
import org.springframework.stereotype.Component; |
15 | 15 |
|
16 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController; |
|
17 | 16 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
18 | 17 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
19 | 18 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
... | ... | |
47 | 46 |
private List<String> getPropertyPaths(Object obj) { |
48 | 47 |
List<String> propertyPaths = null; |
49 | 48 |
ICdmEntitySession cdmEntitySession = |
50 |
((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager().getActiveSession();
|
|
49 |
CdmApplicationState.getCurrentAppConfig().getCdmEntitySessionManager().getActiveSession();
|
|
51 | 50 |
if(cdmEntitySession != null) { |
52 | 51 |
propertyPaths = cdmEntitySession.getPropertyPaths(obj); |
53 | 52 |
} |
... | ... | |
83 | 82 |
public boolean containsValue(UUID ownerUuid, String fieldName, Object element) { |
84 | 83 |
return CdmApplicationState.getCurrentAppConfig().getCommonService().containsValue(ownerUuid, fieldName, element); |
85 | 84 |
} |
86 |
|
|
87 |
} |
|
85 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/RemoteInvocationTermCacher.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
private static Map<TermType, RemoteInvocationResult> termTypeMap = new HashMap<>(); |
36 | 36 |
|
37 |
private static CdmServiceCachingProxy cdmServiceCacher;
|
|
37 |
private static CdmServiceCachingProxy termCachingProxy;
|
|
38 | 38 |
|
39 | 39 |
public static void setDefaultCacher(CdmServiceCachingProxy termCache) { |
40 |
cdmServiceCacher = termCache;
|
|
40 |
termCachingProxy = termCache;
|
|
41 | 41 |
} |
42 | 42 |
|
43 | 43 |
@Override |
44 | 44 |
public void cacheTerms(RemoteInvocation remoteInvoc, RemoteInvocationResult remoteInvocResul) { |
45 |
if(cdmServiceCacher != null) {
|
|
45 |
if(termCachingProxy != null) {
|
|
46 | 46 |
if(remoteInvoc.getMethodName().equals("listByTermType")) { |
47 | 47 |
if(remoteInvoc.getArguments()[1] == null) { |
48 | 48 |
Set<DefinedTermBase<?>> terms = new HashSet<>(); |
... | ... | |
50 | 50 |
terms.addAll((List<DefinedTermBase<?>>)remoteInvocResul.getValue()); |
51 | 51 |
|
52 | 52 |
for(DefinedTermBase<?> term : terms) { |
53 |
cdmServiceCacher.load(term);
|
|
53 |
termCachingProxy.load(term);
|
|
54 | 54 |
} |
55 | 55 |
termTypeMap.put((TermType)remoteInvoc.getArguments()[0], remoteInvocResul); |
56 | 56 |
} |
... | ... | |
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
@Override |
65 |
public RemoteInvocationResult termsFromCache(RemoteInvocation ri) {
|
|
66 |
return termTypeMap.get(ri.getArguments()[0]);
|
|
65 |
public RemoteInvocationResult termsFromCache(RemoteInvocation remoteInvocation) {
|
|
66 |
return termTypeMap.get(remoteInvocation.getArguments()[0]);
|
|
67 | 67 |
} |
68 | 68 |
} |
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/server/CdmStoreConnectorLocal.java | ||
---|---|---|
171 | 171 |
} |
172 | 172 |
|
173 | 173 |
if (!monitor.isCanceled()) { |
174 |
CdmStoreLocal.setInstance(applicationController, cdmSource);
|
|
175 |
CdmStoreLocal.getTermManager().reset();
|
|
174 |
CdmStore.setInstance(applicationController, cdmSource); |
|
175 |
CdmStore.getTermManager().reset(); |
|
176 | 176 |
monitor.subTask(Messages.CdmStoreConnector_AUTHENTICATING_USER); |
177 | 177 |
display.syncExec(()-> { |
178 | 178 |
try { |
eu.etaxonomy.taxeditor.local/src/main/java/eu/etaxonomy/taxeditor/local/server/CdmStoreLocal.java | ||
---|---|---|
33 | 33 |
super(repository, cdmSource); |
34 | 34 |
} |
35 | 35 |
|
36 |
|
|
37 | 36 |
/** |
38 | 37 |
* Initialize with a specific datasource |
39 |
* |
|
40 |
* @param datasource |
|
41 |
* a {@link eu.etaxonomy.cdm.database.ICdmDataSource} object. |
|
42 | 38 |
*/ |
43 | 39 |
public static void connect(ICdmSource cdmSource) { |
44 | 40 |
connect(cdmSource, DEFAULT_DB_SCHEMA_VALIDATION, |
... | ... | |
54 | 50 |
|
55 | 51 |
/** |
56 | 52 |
* Initialize and provide |
57 |
* |
|
58 |
* @param datasource |
|
59 |
* @param dbSchemaValidation |
|
60 |
* @param applicationContextBean |
|
61 | 53 |
*/ |
62 | 54 |
private static void connect(final ICdmSource cdmSource, |
63 | 55 |
final DbSchemaValidation dbSchemaValidation, |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java | ||
---|---|---|
217 | 217 |
RemotingLoginDialog loginDialog = remotingLoginDialog; |
218 | 218 |
if(isActive()) { |
219 | 219 |
// before we connect we clear the entity caches and the sessions |
220 |
CdmRemoteCacheManager.removeEntityCaches(); |
|
220 |
CdmRemoteCacheManager.removeEntityCaches();
|
|
221 | 221 |
if(getCurrentSessionManager(true) != null) { |
222 | 222 |
getCurrentSessionManager(true).disposeAll(); |
223 | 223 |
} |
Also available in: Unified diff
cleanup