Revision 14473bb6
Added by Andreas Müller 5 months ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java | ||
---|---|---|
28 | 28 |
import org.osgi.framework.Constants; |
29 | 29 |
import org.springframework.security.core.context.SecurityContext; |
30 | 30 |
|
31 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
|
|
31 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
|
|
32 | 32 |
import eu.etaxonomy.cdm.api.service.ICommonService; |
33 | 33 |
import eu.etaxonomy.cdm.api.service.IService; |
34 | 34 |
import eu.etaxonomy.cdm.api.service.ITestService; |
... | ... | |
54 | 54 |
//FIXME SecurityContextHolder.getContext() |
55 | 55 |
private SecurityContext securityContext; |
56 | 56 |
|
57 |
private static CdmServiceCacher cdmServiceCacher;
|
|
57 |
private static CdmServiceCachingProxy termProxy;
|
|
58 | 58 |
|
59 | 59 |
private static String cdmlibVersion = null; |
60 | 60 |
private static String cdmlibLastModified = null; |
... | ... | |
117 | 117 |
getInstance().setAppConfig(null); |
118 | 118 |
getInstance().setSecurityContext(null); |
119 | 119 |
cdmApplicationState = null; |
120 |
cdmServiceCacher = null;
|
|
120 |
termProxy = null;
|
|
121 | 121 |
cdmlibVersion = null; |
122 | 122 |
cdmlibLastModified = null; |
123 | 123 |
} |
... | ... | |
185 | 185 |
return ((CdmApplicationRemoteController)configuration).getCachedCommonService(); |
186 | 186 |
} |
187 | 187 |
|
188 |
public static CdmServiceCacher getCdmServiceCacher() {
|
|
189 |
return cdmServiceCacher;
|
|
188 |
public static CdmServiceCachingProxy getTermProxy() {
|
|
189 |
return termProxy;
|
|
190 | 190 |
} |
191 | 191 |
|
192 |
public static void setCdmServiceCacher(CdmServiceCacher cacher) {
|
|
193 |
cdmServiceCacher = cacher;
|
|
192 |
public static void setTermProxy(CdmServiceCachingProxy cacher) {
|
|
193 |
termProxy = cacher;
|
|
194 | 194 |
} |
195 | 195 |
|
196 | 196 |
public static void updateCdmlibManifestInfo() { |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.api.cache; |
|
10 |
|
|
11 |
import java.io.File; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
17 |
import eu.etaxonomy.cdm.api.config.EhCacheConfiguration; |
|
18 |
import eu.etaxonomy.cdm.cache.CacheLoader; |
|
19 |
import eu.etaxonomy.cdm.cache.CdmEntityCacheKey; |
|
20 |
import eu.etaxonomy.cdm.cache.CdmTransientEntityCacher; |
|
21 |
import eu.etaxonomy.cdm.config.ConfigFileUtil; |
|
22 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
23 |
import eu.etaxonomy.cdm.model.term.DefinedTermBase; |
|
24 |
import eu.etaxonomy.cdm.model.term.Representation; |
|
25 |
import eu.etaxonomy.cdm.model.term.TermBase; |
|
26 |
import eu.etaxonomy.taxeditor.service.RemoteInvocationTermCacher; |
|
27 |
import eu.etaxonomy.taxeditor.session.CdmEntitySession; |
|
28 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
29 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; |
|
30 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver; |
|
31 |
import net.sf.ehcache.config.CacheConfiguration; |
|
32 |
import net.sf.ehcache.config.DiskStoreConfiguration; |
|
33 |
import net.sf.ehcache.config.SizeOfPolicyConfiguration; |
|
34 |
|
|
35 |
/** |
|
36 |
* Class which uses CDM services to cache cdm entities |
|
37 |
* |
|
38 |
* FIXME: Currently only handles term entities. It would be |
|
39 |
* interesting to have a generic method which finds the |
|
40 |
* correct service to load / cache the entity. |
|
41 |
* |
|
42 |
* @author cmathew |
|
43 |
*/ |
|
44 |
public class CdmServiceCacher extends CdmCacherBase implements ICdmEntitySessionManagerObserver { |
|
45 |
|
|
46 |
private ICdmEntitySessionManager cdmEntitySessionManager; |
|
47 |
|
|
48 |
private CdmTransientEntityCacher cdmTransientEntityCacher; |
|
49 |
|
|
50 |
private CacheLoader cacheLoader; |
|
51 |
|
|
52 |
@Autowired |
|
53 |
private ConfigFileUtil configFileUtil = null; |
|
54 |
|
|
55 |
@Override |
|
56 |
protected void setup() { |
|
57 |
|
|
58 |
setUpCacheManager(); |
|
59 |
|
|
60 |
DefinedTermBase.setCacher(this); |
|
61 |
CdmTransientEntityCacher.setPermanentCacher(this); |
|
62 |
//TermServiceRequestExecutor.setDefaultCacher(this); |
|
63 |
RemoteInvocationTermCacher.setDefaultCacher(this); |
|
64 |
|
|
65 |
cacheLoader = new CacheLoader(this); |
|
66 |
} |
|
67 |
|
|
68 |
private void setUpCacheManager() { |
|
69 |
|
|
70 |
EhCacheConfiguration cacheConfig = new EhCacheConfiguration(); |
|
71 |
|
|
72 |
DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration(); |
|
73 |
File ehcacheFolder = null; |
|
74 |
if(configFileUtil != null){ |
|
75 |
try { |
|
76 |
ehcacheFolder = configFileUtil.getCdmHomeSubDir("taxeditor-ehcache"); |
|
77 |
} catch (Exception e){ |
|
78 |
logger.warn("Cannot determine CdmHomeSubDir for ./taxeditor-ehcache, will use fallback method.", e); |
|
79 |
} |
|
80 |
} |
|
81 |
if(ehcacheFolder == null){ |
|
82 |
ehcacheFolder = ConfigFileUtil.getCdmHomeSubDirFallback("taxeditor-ehcache"); |
|
83 |
} |
|
84 |
|
|
85 |
// FIXME use subfolder per taxeditor version to allow running multiple installations in parallel |
|
86 |
// String taxEditorVersion = ..; |
|
87 |
// File ehcacheFolder = new File(ehcacheFolder, taxEditorVersion); |
|
88 |
diskStoreConfiguration.setPath(ehcacheFolder.getAbsolutePath()); |
|
89 |
|
|
90 |
cacheConfig.setDiskStoreConfiguration(diskStoreConfiguration); |
|
91 |
addCacheManager(cacheConfig.cacheManager()); |
|
92 |
} |
|
93 |
|
|
94 |
@Override |
|
95 |
protected CacheConfiguration getDefaultCacheConfiguration() { |
|
96 |
// For a better understanding on how to size caches, refer to |
|
97 |
// http://ehcache.org/documentation/configuration/cache-size |
|
98 |
|
|
99 |
SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration(); |
|
100 |
sizeOfConfig.setMaxDepth(100); |
|
101 |
sizeOfConfig.setMaxDepthExceededBehavior("abort"); |
|
102 |
|
|
103 |
return new CacheConfiguration(DEFAULT_CACHE_NAME, 0) |
|
104 |
.eternal(true) |
|
105 |
.statistics(true) |
|
106 |
.sizeOfPolicy(sizeOfConfig) |
|
107 |
.overflowToOffHeap(false); |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
protected CdmBase findByUuid(UUID uuid) { |
|
112 |
CdmBase term = CdmApplicationState.getCurrentAppConfig().getTermService().findWithoutFlush(uuid); |
|
113 |
return load(term); |
|
114 |
} |
|
115 |
|
|
116 |
@Override |
|
117 |
public boolean isCachable(CdmBase cdmEntity) { |
|
118 |
if(cdmEntity == null){ |
|
119 |
return false; |
|
120 |
}else if (cdmEntity instanceof TermBase || cdmEntity instanceof Representation){ |
|
121 |
return true; |
|
122 |
}else{ |
|
123 |
return false; |
|
124 |
} |
|
125 |
} |
|
126 |
|
|
127 |
public void setCdmEntitySessionManager(ICdmEntitySessionManager cdmEntitySessionManager) { |
|
128 |
this.cdmEntitySessionManager = cdmEntitySessionManager; |
|
129 |
if(cdmEntitySessionManager != null) { |
|
130 |
cdmEntitySessionManager.addSessionObserver(this); |
|
131 |
} |
|
132 |
} |
|
133 |
|
|
134 |
public CdmTransientEntityCacher getCurrentCacher() { |
|
135 |
ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession(); |
|
136 |
if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) { |
|
137 |
return ((CdmEntitySession) cdmEntitySession).getCacher(); |
|
138 |
} |
|
139 |
return null; |
|
140 |
} |
|
141 |
|
|
142 |
@Override |
|
143 |
public <T extends CdmBase> T getFromCache(T cdmBase) { |
|
144 |
T cachedCdmEntity = null; |
|
145 |
// first we check in the active session cache if the |
|
146 |
// entity has been loaded there |
|
147 |
// FIXME:Remoting do we really need the cdmTransientEntityCacher |
|
148 |
// here. Is it not guaranteed that all every entity which 'isCachable' |
|
149 |
// by this cacher is cached only in this cacher ? |
|
150 |
if(!isCachable(cdmBase) && cdmTransientEntityCacher != null) { |
|
151 |
CdmEntityCacheKey<T> key = CdmTransientEntityCacher.generateKey(cdmBase); |
|
152 |
cachedCdmEntity = cdmTransientEntityCacher.getFromCache(key); |
|
153 |
} |
|
154 |
if(cachedCdmEntity == null) { |
|
155 |
cachedCdmEntity = super.getFromCache(cdmBase); |
|
156 |
} |
|
157 |
return cachedCdmEntity; |
|
158 |
} |
|
159 |
|
|
160 |
@Override |
|
161 |
public <T extends CdmBase> T load(T cdmEntity) { |
|
162 |
@SuppressWarnings("unchecked") |
|
163 |
T cachedCdmEntity = (T)getFromCache(cdmEntity.getUuid()); |
|
164 |
|
|
165 |
if(isCachable(cdmEntity) && cachedCdmEntity == null) { |
|
166 |
cachedCdmEntity = cacheLoader.load(cdmEntity, false, true); |
|
167 |
} |
|
168 |
return cachedCdmEntity; |
|
169 |
} |
|
170 |
|
|
171 |
@Override |
|
172 |
public void changed() { |
|
173 |
ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession(); |
|
174 |
if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) { |
|
175 |
this.cdmTransientEntityCacher = ((CdmEntitySession) cdmEntitySession).getCacher(); |
|
176 |
} else { |
|
177 |
this.cdmTransientEntityCacher = null; |
|
178 |
} |
|
179 |
} |
|
180 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCachingProxy.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2015 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.api.cache; |
|
10 |
|
|
11 |
import java.io.File; |
|
12 |
import java.util.UUID; |
|
13 |
|
|
14 |
import org.springframework.beans.factory.annotation.Autowired; |
|
15 |
|
|
16 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
|
17 |
import eu.etaxonomy.cdm.api.config.EhCacheConfiguration; |
|
18 |
import eu.etaxonomy.cdm.cache.CacheLoader; |
|
19 |
import eu.etaxonomy.cdm.cache.CdmEntityCacheKey; |
|
20 |
import eu.etaxonomy.cdm.cache.CdmTransientEntityCacher; |
|
21 |
import eu.etaxonomy.cdm.config.ConfigFileUtil; |
|
22 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
23 |
import eu.etaxonomy.cdm.model.term.DefinedTermBase; |
|
24 |
import eu.etaxonomy.cdm.model.term.Representation; |
|
25 |
import eu.etaxonomy.cdm.model.term.TermBase; |
|
26 |
import eu.etaxonomy.taxeditor.service.RemoteInvocationTermCacher; |
|
27 |
import eu.etaxonomy.taxeditor.session.CdmEntitySession; |
|
28 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession; |
|
29 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager; |
|
30 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManagerObserver; |
|
31 |
import net.sf.ehcache.config.CacheConfiguration; |
|
32 |
import net.sf.ehcache.config.DiskStoreConfiguration; |
|
33 |
import net.sf.ehcache.config.SizeOfPolicyConfiguration; |
|
34 |
|
|
35 |
/** |
|
36 |
* Class which uses CDM services to cache cdm entities |
|
37 |
* |
|
38 |
* FIXME: Currently only handles term entities. It would be |
|
39 |
* interesting to have a generic method which finds the |
|
40 |
* correct service to load / cache the entity. |
|
41 |
* TODO by AM: compare with {@link CdmTermCacher} and merge if possible |
|
42 |
* |
|
43 |
* @author cmathew |
|
44 |
*/ |
|
45 |
public class CdmServiceCachingProxy |
|
46 |
extends CdmCacherBase |
|
47 |
implements ICdmEntitySessionManagerObserver { |
|
48 |
|
|
49 |
private ICdmEntitySessionManager cdmEntitySessionManager; |
|
50 |
|
|
51 |
private CdmTransientEntityCacher cdmTransientEntityCacher; |
|
52 |
|
|
53 |
private CacheLoader cacheLoader; |
|
54 |
|
|
55 |
@Autowired |
|
56 |
private ConfigFileUtil configFileUtil = null; |
|
57 |
|
|
58 |
@Override |
|
59 |
protected void setup() { |
|
60 |
|
|
61 |
setUpCacheManager(); |
|
62 |
|
|
63 |
DefinedTermBase.setCacher(this); |
|
64 |
CdmTransientEntityCacher.setPermanentCacher(this); |
|
65 |
//TermServiceRequestExecutor.setDefaultCacher(this); |
|
66 |
RemoteInvocationTermCacher.setDefaultCacher(this); |
|
67 |
|
|
68 |
cacheLoader = new CacheLoader(this); |
|
69 |
} |
|
70 |
|
|
71 |
private void setUpCacheManager() { |
|
72 |
|
|
73 |
EhCacheConfiguration cacheConfig = new EhCacheConfiguration(); |
|
74 |
|
|
75 |
DiskStoreConfiguration diskStoreConfiguration = new DiskStoreConfiguration(); |
|
76 |
File ehcacheFolder = null; |
|
77 |
if(configFileUtil != null){ |
|
78 |
try { |
|
79 |
ehcacheFolder = configFileUtil.getCdmHomeSubDir("taxeditor-ehcache"); |
|
80 |
} catch (Exception e){ |
|
81 |
logger.warn("Cannot determine CdmHomeSubDir for ./taxeditor-ehcache, will use fallback method.", e); |
|
82 |
} |
|
83 |
} |
|
84 |
if(ehcacheFolder == null){ |
|
85 |
ehcacheFolder = ConfigFileUtil.getCdmHomeSubDirFallback("taxeditor-ehcache"); |
|
86 |
} |
|
87 |
|
|
88 |
// FIXME use subfolder per taxeditor version to allow running multiple installations in parallel |
|
89 |
// String taxEditorVersion = ..; |
|
90 |
// File ehcacheFolder = new File(ehcacheFolder, taxEditorVersion); |
|
91 |
diskStoreConfiguration.setPath(ehcacheFolder.getAbsolutePath()); |
|
92 |
|
|
93 |
cacheConfig.setDiskStoreConfiguration(diskStoreConfiguration); |
|
94 |
setCacheManager(cacheConfig.cacheManager()); |
|
95 |
} |
|
96 |
|
|
97 |
@Override |
|
98 |
protected CacheConfiguration getDefaultCacheConfiguration() { |
|
99 |
// For a better understanding on how to size caches, refer to |
|
100 |
// http://ehcache.org/documentation/configuration/cache-size |
|
101 |
|
|
102 |
SizeOfPolicyConfiguration sizeOfConfig = new SizeOfPolicyConfiguration(); |
|
103 |
sizeOfConfig.setMaxDepth(100); |
|
104 |
sizeOfConfig.setMaxDepthExceededBehavior("abort"); |
|
105 |
|
|
106 |
return new CacheConfiguration(DEFAULT_CACHE_NAME, 0) |
|
107 |
.eternal(true) |
|
108 |
.statistics(true) |
|
109 |
.sizeOfPolicy(sizeOfConfig) |
|
110 |
.overflowToOffHeap(false); |
|
111 |
} |
|
112 |
|
|
113 |
@Override |
|
114 |
protected CdmBase findByUuid(UUID uuid) { |
|
115 |
CdmBase term = CdmApplicationState.getCurrentAppConfig().getTermService().findWithoutFlush(uuid); |
|
116 |
return load(term); |
|
117 |
} |
|
118 |
|
|
119 |
/** |
|
120 |
* <code>true</code> if the parameter is a term or a representation |
|
121 |
*/ |
|
122 |
@Override |
|
123 |
public boolean isCachable(CdmBase cdmEntity) { |
|
124 |
if(cdmEntity == null){ |
|
125 |
return false; |
|
126 |
}else if (cdmEntity instanceof TermBase || cdmEntity instanceof Representation){ |
|
127 |
return true; |
|
128 |
}else{ |
|
129 |
return false; |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
public void setCdmEntitySessionManager(ICdmEntitySessionManager cdmEntitySessionManager) { |
|
134 |
this.cdmEntitySessionManager = cdmEntitySessionManager; |
|
135 |
if(cdmEntitySessionManager != null) { |
|
136 |
cdmEntitySessionManager.addSessionObserver(this); |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
public CdmTransientEntityCacher getCurrentCacher() { |
|
141 |
ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession(); |
|
142 |
if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) { |
|
143 |
return ((CdmEntitySession) cdmEntitySession).getCacher(); |
|
144 |
} |
|
145 |
return null; |
|
146 |
} |
|
147 |
|
|
148 |
@Override |
|
149 |
public <T extends CdmBase> T getFromCache(T cdmBase) { |
|
150 |
T cachedCdmEntity = null; |
|
151 |
// first we check in the active session cache if the |
|
152 |
// entity has been loaded there |
|
153 |
// FIXME:Remoting do we really need the cdmTransientEntityCacher |
|
154 |
// here. Is it not guaranteed that every entity which 'isCachable' |
|
155 |
// by this cacher is cached only in this cacher ? |
|
156 |
if(!isCachable(cdmBase) && cdmTransientEntityCacher != null) { |
|
157 |
CdmEntityCacheKey<T> key = CdmTransientEntityCacher.generateKey(cdmBase); |
|
158 |
cachedCdmEntity = cdmTransientEntityCacher.getFromCache(key); |
|
159 |
} |
|
160 |
if(cachedCdmEntity == null) { |
|
161 |
cachedCdmEntity = super.getFromCache(cdmBase); |
|
162 |
} |
|
163 |
return cachedCdmEntity; |
|
164 |
} |
|
165 |
|
|
166 |
@Override |
|
167 |
public <T extends CdmBase> T load(T cdmEntity) { |
|
168 |
@SuppressWarnings("unchecked") |
|
169 |
T cachedCdmEntity = (T)getFromCache(cdmEntity.getUuid()); |
|
170 |
|
|
171 |
if(isCachable(cdmEntity) && cachedCdmEntity == null) { |
|
172 |
cachedCdmEntity = cacheLoader.load(cdmEntity, false, true); |
|
173 |
} |
|
174 |
return cachedCdmEntity; |
|
175 |
} |
|
176 |
|
|
177 |
@Override |
|
178 |
public void changed() { |
|
179 |
ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession(); |
|
180 |
if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) { |
|
181 |
this.cdmTransientEntityCacher = ((CdmEntitySession) cdmEntitySession).getCacher(); |
|
182 |
} else { |
|
183 |
this.cdmTransientEntityCacher = null; |
|
184 |
} |
|
185 |
} |
|
186 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/RemoteInvocationTermCacher.java | ||
---|---|---|
19 | 19 |
import org.springframework.remoting.support.RemoteInvocation; |
20 | 20 |
import org.springframework.remoting.support.RemoteInvocationResult; |
21 | 21 |
|
22 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
|
|
22 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
|
|
23 | 23 |
import eu.etaxonomy.cdm.model.term.DefinedTermBase; |
24 | 24 |
import eu.etaxonomy.cdm.model.term.TermType; |
25 | 25 |
|
... | ... | |
34 | 34 |
|
35 | 35 |
private static Map<TermType, RemoteInvocationResult> termTypeMap = new HashMap<>(); |
36 | 36 |
|
37 |
private static CdmServiceCacher cdmServiceCacher;
|
|
37 |
private static CdmServiceCachingProxy cdmServiceCacher;
|
|
38 | 38 |
|
39 |
public static void setDefaultCacher(CdmServiceCacher csc) {
|
|
39 |
public static void setDefaultCacher(CdmServiceCachingProxy csc) {
|
|
40 | 40 |
cdmServiceCacher = csc; |
41 | 41 |
} |
42 | 42 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java | ||
---|---|---|
26 | 26 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController; |
27 | 27 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
28 | 28 |
import eu.etaxonomy.cdm.api.application.ICdmRepository; |
29 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
|
|
29 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
|
|
30 | 30 |
import eu.etaxonomy.cdm.api.service.IAgentService; |
31 | 31 |
import eu.etaxonomy.cdm.api.service.IAnnotationService; |
32 | 32 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
... | ... | |
277 | 277 |
public static void setInstance(CdmApplicationRemoteController applicationController, |
278 | 278 |
ICdmSource cdmSource) { |
279 | 279 |
instance = new CdmStore(applicationController, cdmSource); |
280 |
CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
|
|
280 |
CdmApplicationState.setTermProxy(new CdmServiceCachingProxy());
|
|
281 | 281 |
} |
282 | 282 |
|
283 | 283 |
protected CdmStore(CdmApplicationRemoteController repository, |
... | ... | |
290 | 290 |
|
291 | 291 |
/** |
292 | 292 |
* All calls to the datastore require |
293 |
* |
|
294 |
* @return |
|
295 | 293 |
*/ |
296 | 294 |
private CdmApplicationRemoteController getApplicationConfiguration() { |
297 | 295 |
try { |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/sessions/SessionsViewPart.java | ||
---|---|---|
295 | 295 |
txtCdmModelInMemory.setText(getInMemoryStats(liveCacheStatistics)); |
296 | 296 |
txtCdmModelOnDisk.setText(getOnDiskStats(liveCacheStatistics)); |
297 | 297 |
} |
298 |
|
|
299 | 298 |
} |
300 | 299 |
|
301 | 300 |
private void addSession(ICdmEntitySession session) { |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController; |
26 | 26 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
27 | 27 |
import eu.etaxonomy.cdm.api.application.CdmDataChangeService; |
28 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
|
|
28 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
|
|
29 | 29 |
import eu.etaxonomy.cdm.cache.CdmRemoteCacheManager; |
30 | 30 |
import eu.etaxonomy.cdm.model.permission.User; |
31 | 31 |
import eu.etaxonomy.taxeditor.remoting.cache.ConversationalTransientEntityCacher; |
... | ... | |
93 | 93 |
null, |
94 | 94 |
null); |
95 | 95 |
CdmApplicationState.setCurrentAppConfig(remoteApplicationController); |
96 |
CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
|
|
96 |
CdmApplicationState.setTermProxy(new CdmServiceCachingProxy());
|
|
97 | 97 |
|
98 | 98 |
cdmEntitySessionManager = getRemoteApplicationController().getCdmEntitySessionManager(); |
99 | 99 |
|
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/lazyloading/CdmServiceCacherTest.java | ||
---|---|---|
14 | 14 |
import org.junit.Test; |
15 | 15 |
|
16 | 16 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
17 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
|
|
17 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
|
|
18 | 18 |
import eu.etaxonomy.cdm.model.common.Language; |
19 | 19 |
import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest; |
20 | 20 |
|
... | ... | |
23 | 23 |
@SuppressWarnings("unused") |
24 | 24 |
private static final Logger logger = LogManager.getLogger(CdmServiceCacherTest.class); |
25 | 25 |
|
26 |
private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
|
|
26 |
private static CdmServiceCachingProxy cdmServiceCacher = CdmApplicationState.getTermProxy();
|
|
27 | 27 |
|
28 | 28 |
@Test |
29 | 29 |
public void testLanguageCache() { |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/service/ServiceInterceptorTest.java | ||
---|---|---|
9 | 9 |
import org.junit.Test; |
10 | 10 |
|
11 | 11 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState; |
12 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
|
|
12 |
import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
|
|
13 | 13 |
import eu.etaxonomy.cdm.api.service.ITermService; |
14 | 14 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
15 | 15 |
import eu.etaxonomy.cdm.model.common.Language; |
... | ... | |
22 | 22 |
@SuppressWarnings("unused") |
23 | 23 |
private static final Logger logger = LogManager.getLogger(ServiceInterceptorTest.class); |
24 | 24 |
private final ITermService termService = getRemoteApplicationController().getTermService(); |
25 |
private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
|
|
25 |
private static CdmServiceCachingProxy cdmServiceCacher = CdmApplicationState.getTermProxy();
|
|
26 | 26 |
|
27 | 27 |
|
28 | 28 |
@Test |
Also available in: Unified diff
cleanup and renaming for caching