import org.osgi.framework.Constants;
import org.springframework.security.core.context.SecurityContext;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.IService;
import eu.etaxonomy.cdm.api.service.ITestService;
//FIXME SecurityContextHolder.getContext()
private SecurityContext securityContext;
- private static CdmServiceCacher cdmServiceCacher;
+ private static CdmServiceCachingProxy termProxy;
private static String cdmlibVersion = null;
private static String cdmlibLastModified = null;
getInstance().setAppConfig(null);
getInstance().setSecurityContext(null);
cdmApplicationState = null;
- cdmServiceCacher = null;
+ termProxy = null;
cdmlibVersion = null;
cdmlibLastModified = null;
}
return ((CdmApplicationRemoteController)configuration).getCachedCommonService();
}
- public static CdmServiceCacher getCdmServiceCacher() {
- return cdmServiceCacher;
+ public static CdmServiceCachingProxy getTermProxy() {
+ return termProxy;
}
- public static void setCdmServiceCacher(CdmServiceCacher cacher) {
- cdmServiceCacher = cacher;
+ public static void setTermProxy(CdmServiceCachingProxy cacher) {
+ termProxy = cacher;
}
public static void updateCdmlibManifestInfo() {
* FIXME: Currently only handles term entities. It would be
* interesting to have a generic method which finds the
* correct service to load / cache the entity.
+ * TODO by AM: compare with {@link CdmTermCacher} and merge if possible
*
* @author cmathew
*/
-public class CdmServiceCacher extends CdmCacherBase implements ICdmEntitySessionManagerObserver {
+public class CdmServiceCachingProxy
+ extends CdmCacherBase
+ implements ICdmEntitySessionManagerObserver {
private ICdmEntitySessionManager cdmEntitySessionManager;
diskStoreConfiguration.setPath(ehcacheFolder.getAbsolutePath());
cacheConfig.setDiskStoreConfiguration(diskStoreConfiguration);
- addCacheManager(cacheConfig.cacheManager());
+ setCacheManager(cacheConfig.cacheManager());
}
@Override
return load(term);
}
+ /**
+ * <code>true</code> if the parameter is a term or a representation
+ */
@Override
public boolean isCachable(CdmBase cdmEntity) {
if(cdmEntity == null){
// first we check in the active session cache if the
// entity has been loaded there
// FIXME:Remoting do we really need the cdmTransientEntityCacher
- // here. Is it not guaranteed that all every entity which 'isCachable'
+ // here. Is it not guaranteed that every entity which 'isCachable'
// by this cacher is cached only in this cacher ?
if(!isCachable(cdmBase) && cdmTransientEntityCacher != null) {
CdmEntityCacheKey<T> key = CdmTransientEntityCacher.generateKey(cdmBase);
import org.springframework.remoting.support.RemoteInvocation;
import org.springframework.remoting.support.RemoteInvocationResult;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
import eu.etaxonomy.cdm.model.term.TermType;
private static Map<TermType, RemoteInvocationResult> termTypeMap = new HashMap<>();
- private static CdmServiceCacher cdmServiceCacher;
+ private static CdmServiceCachingProxy cdmServiceCacher;
- public static void setDefaultCacher(CdmServiceCacher csc) {
+ public static void setDefaultCacher(CdmServiceCachingProxy csc) {
cdmServiceCacher = csc;
}
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.api.service.IAgentService;
import eu.etaxonomy.cdm.api.service.IAnnotationService;
import eu.etaxonomy.cdm.api.service.IClassificationService;
public static void setInstance(CdmApplicationRemoteController applicationController,
ICdmSource cdmSource) {
instance = new CdmStore(applicationController, cdmSource);
- CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+ CdmApplicationState.setTermProxy(new CdmServiceCachingProxy());
}
protected CdmStore(CdmApplicationRemoteController repository,
/**
* All calls to the datastore require
- *
- * @return
*/
private CdmApplicationRemoteController getApplicationConfiguration() {
try {
txtCdmModelInMemory.setText(getInMemoryStats(liveCacheStatistics));
txtCdmModelOnDisk.setText(getOnDiskStats(liveCacheStatistics));
}
-
}
private void addSession(ICdmEntitySession session) {
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.application.CdmDataChangeService;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.cache.CdmRemoteCacheManager;
import eu.etaxonomy.cdm.model.permission.User;
import eu.etaxonomy.taxeditor.remoting.cache.ConversationalTransientEntityCacher;
null,
null);
CdmApplicationState.setCurrentAppConfig(remoteApplicationController);
- CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());
+ CdmApplicationState.setTermProxy(new CdmServiceCachingProxy());
cdmEntitySessionManager = getRemoteApplicationController().getCdmEntitySessionManager();
import org.junit.Test;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.model.common.Language;
import eu.etaxonomy.taxeditor.httpinvoker.RemotingSessionAwareTest;
@SuppressWarnings("unused")
private static final Logger logger = LogManager.getLogger(CdmServiceCacherTest.class);
- private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
+ private static CdmServiceCachingProxy cdmServiceCacher = CdmApplicationState.getTermProxy();
@Test
public void testLanguageCache() {
import org.junit.Test;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCachingProxy;
import eu.etaxonomy.cdm.api.service.ITermService;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.Language;
@SuppressWarnings("unused")
private static final Logger logger = LogManager.getLogger(ServiceInterceptorTest.class);
private final ITermService termService = getRemoteApplicationController().getTermService();
- private static CdmServiceCacher cdmServiceCacher = CdmApplicationState.getCdmServiceCacher();
+ private static CdmServiceCachingProxy cdmServiceCacher = CdmApplicationState.getTermProxy();
@Test