<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src/main/java/"/>
- <classpathentry kind="src" path="src/main/resources/"/>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="resources"/>
+ <classpathentry kind="src" path="src/main/resources"/>
<classpathentry exported="true" kind="lib" path="lib/activation-1.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/antlr-2.7.7.jar"/>
<classpathentry exported="true" kind="lib" path="lib/aopalliance-1.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.8.0-SNAPSHOT.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.8.0-SNAPSHOT.jar"/>
<classpathentry exported="true" kind="lib" path="lib/apache-log4j-extras-1.2.17.jar"/>
- <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.osgi,
org.eclipse.equinox.common,
- org.apache.commons.httpclient;bundle-version="3.1.0"
+ org.apache.commons.httpclient;bundle-version="3.1.0",
+ org.eclipse.core.runtime
Bundle-ClassPath: .,
lib/activation-1.1.1.jar,
lib/antlr-2.7.7.jar,
lib/cdmlib-print-3.8.0-SNAPSHOT.jar,\\r
lib/cdmlib-remote-3.8.0-SNAPSHOT.jar,\\r
lib/cdmlib-services-3.8.0-SNAPSHOT.jar,\\r
- lib/apache-log4j-extras-1.2.17.jar\r
+ lib/apache-log4j-extras-1.2.17.jar,\\r
+ cdm.map.ser\r
\r
jars.compile.order = .\r
output.. = bin/\r
GenericApplicationContext applicationContext = new GenericApplicationContext();
- int nTasks = 2;
+ int nTasks = 3;
progressMonitor.beginTask("Connecting to '" + remoteSource.getName() + "'", nTasks);
- progressMonitor.subTask("Loading context beans ...");
- // initialising the cdm model cache
+ progressMonitor.subTask("Initialising CDM Model Cache ...");
CdmRemoteCacheManager.getInstance();
+ progressMonitor.subTask("Loading context beans ...");
PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer();
Properties properties = new Properties();
properties.setProperty("remoteServer", remoteSource.getServer());
import org.springframework.security.core.context.SecurityContext;
+import eu.etaxonomy.cdm.api.cache.CdmServiceCacher;
import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.api.service.IService;
import eu.etaxonomy.cdm.api.service.ITestService;
public static CdmApplicationState getInstance() {
if(cdmApplicationState == null) {
cdmApplicationState = new CdmApplicationState();
+ new CdmServiceCacher();
}
return cdmApplicationState;
}
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.config.SizeOfPolicyConfiguration;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import eu.etaxonomy.cdm.api.service.ITermService;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.model.common.CdmBase;
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
import eu.etaxonomy.taxeditor.remoting.cache.CacheLoader;
@Component
public class CdmServiceCacher extends CdmCacher implements ICdmEntitySessionManagerObserver {
- @Autowired
- ITermService termService;
private ICdmEntitySessionManager cdmEntitySessionManager;
DefinedTermBase.setCacher(this);
CdmTransientEntityCacher.setDefaultCacher(this);
TermServiceRequestExecutor.setDefaultCacher(this);
+
cacheLoader = new CacheLoader(this);
}
@Override
protected CdmBase findByUuid(UUID uuid) {
- CdmBase term = termService.findWithoutFlush(uuid);
+ CdmBase term = CdmApplicationState.getCurrentAppConfig().getTermService().findWithoutFlush(uuid);
return load(term);
}
package eu.etaxonomy.taxeditor.remoting.cache;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.HashMap;
import java.util.Iterator;
-import java.util.List;
+import java.util.Map;
import net.sf.ehcache.Cache;
import net.sf.ehcache.Element;
-import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.property.Getter;
+import org.osgi.framework.Bundle;
public class CdmModelCacher {
- private static final Logger logger = Logger.getLogger(CdmModelCacher.class);
- public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml";
- private final List<CdmModelFieldPropertyFromClass> cmgmfcList = new ArrayList<CdmModelFieldPropertyFromClass>();
+ public static String HB_CONFIG_FILE_PATH= "/eu/etaxonomy/cdm/mappings/hibernate.cfg.xml";
+ public static final String CDM_MAP_SER_FILE_PATH = "resources/cdm.map.ser";
- public static Configuration buildConfiguration() {
- Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
+
+
+
+ public void cacheGetterFields(Cache cache) throws IOException, ClassNotFoundException, URISyntaxException {
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = loadModelClassMap();
+
+ cache.removeAll();
+
+ for(Map.Entry<String, CdmModelFieldPropertyFromClass> entry : modelClassMap.entrySet()) {
+ cache.put(new Element(entry.getKey(), entry.getValue()));
+ }
+ }
+
+ public Map<String, CdmModelFieldPropertyFromClass> loadModelClassMap() throws URISyntaxException, IOException, ClassNotFoundException {
+
+ Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.cdmlib");
+
+ URL modelMapFileURL = bundle.getEntry(CDM_MAP_SER_FILE_PATH);
+ File modelMapFile = new File(FileLocator.resolve(modelMapFileURL).toURI());
+
+ FileInputStream fin = new FileInputStream(modelMapFile);
+ ObjectInputStream ois = new ObjectInputStream(fin);
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = (Map<String, CdmModelFieldPropertyFromClass>) ois.readObject();
+ ois.close();
+ return modelClassMap;
+ }
+
+
+ public Map<String, CdmModelFieldPropertyFromClass> generateModelClassMap() {
+
+ Configuration configuration = buildConfiguration(HB_CONFIG_FILE_PATH);
+ Iterator<PersistentClass> classMappingIterator = configuration.getClassMappings();
+
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = new HashMap<String, CdmModelFieldPropertyFromClass>();
+
+ while(classMappingIterator.hasNext()) {
+ PersistentClass persistentClass = classMappingIterator.next();
+ Class mappedClass = persistentClass.getMappedClass();
+ String mappedClassName = mappedClass.getName();
+
+ CdmModelFieldPropertyFromClass cmgmfc = new CdmModelFieldPropertyFromClass(mappedClassName);
+ System.out.println("Adding class : " + mappedClassName + " to cache");
+ addGetters(persistentClass, cmgmfc);
+ modelClassMap.put(mappedClassName, cmgmfc);
+ }
+ return modelClassMap;
+ }
+
+
+ public static Configuration buildConfiguration(String hibernateConfigFilePath) {
+ Configuration configuration = new Configuration().configure(hibernateConfigFilePath);
configuration.buildMappings();
return configuration;
- }
-
- public void cacheGetterFields(Cache cache) {
-
- Configuration configuration = buildConfiguration();
- Iterator<PersistentClass> classMappingIterator = configuration.getClassMappings();
-
- cache.removeAll();
-
- while(classMappingIterator.hasNext()) {
- PersistentClass persistentClass = classMappingIterator.next();
- Class mappedClass = persistentClass.getMappedClass();
- String mappedClassName = mappedClass.getName();
-
- CdmModelFieldPropertyFromClass cmgmfc = new CdmModelFieldPropertyFromClass(mappedClassName);
- //logger.info("Adding class : " + mappedClassName + " to cache");
- addGetters(persistentClass, cmgmfc);
- cache.put(new Element(mappedClassName, cmgmfc));
- }
-
- }
-
- private void addGetters(PersistentClass persistentClass, CdmModelFieldPropertyFromClass cmgmfc) {
- if (persistentClass != null) {
- Iterator propertyIt = persistentClass.getPropertyIterator();
-
- while(propertyIt.hasNext())
- {
- Property property = (Property)propertyIt.next();
- Getter getter = property.getGetter(persistentClass.getMappedClass());
- if(getter != null && getter.getMember() != null) {
- Field field = (Field)getter.getMember();
-
- //logger.info(" - contains field '" + field.getName() + "' of type '" + field.getType().getName() + "'");
- cmgmfc.addGetMethods(field.getName());
- }
- }
- addGetters(persistentClass.getSuperclass(), cmgmfc);
- }
- }
-
- public void checkGetterMethods() {
-
- Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
- configuration.buildMappings();
- Iterator<PersistentClass> classMappingIterator = configuration.getClassMappings();
-
- Cache cache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
- cache.removeAll();
-
- while(classMappingIterator.hasNext()) {
- PersistentClass persistentClass = classMappingIterator.next();
- Class mappedClass = persistentClass.getMappedClass();
- String mappedClassName = mappedClass.getName();
-
- Iterator propertyIt = persistentClass.getPropertyIterator();
-
- Method[] methods = mappedClass.getMethods();
-
- while(propertyIt.hasNext())
- {
- Property property = (Property)propertyIt.next();
- Getter getter = property.getGetter(mappedClass);
- if(getter != null && getter.getMember() != null) {
- Field field = (Field)getter.getMember();
- String getMethod = getMethodNameFromFieldName(field.getName(), field.getType().getName());
-
- boolean foundMethod = false;
- for(Method method : methods) {
- if(method.getName().equals(getMethod)) {
- foundMethod = true;
- break;
- }
- }
- if(!foundMethod) {
- logger.info("Inferred method " + getMethod + " does not exist in class " + mappedClassName);
- //throw new CdmClientCacheException("Inferred method " + getMethod + " does not exist in class " + mappedClassName);
- }
- }
- }
-
-
- }
-
- }
-
- public List<CdmModelFieldPropertyFromClass> getCdmModelGetMethodFromClassList() {
- cmgmfcList.clear();
- Configuration configuration = new Configuration().configure(HB_CONFIG_FILE_PATH);
- configuration.buildMappings();
- Iterator<PersistentClass> classMappingIterator = configuration.getClassMappings();
-
- while(classMappingIterator.hasNext()) {
- PersistentClass persistentClass = classMappingIterator.next();
- Class mappedClass = persistentClass.getMappedClass();
- String mappedClassName = mappedClass.getName();
-
- CdmModelFieldPropertyFromClass cmgmfc = new CdmModelFieldPropertyFromClass(mappedClassName);
- Iterator propertyIt = persistentClass.getPropertyIterator();
-
- while(propertyIt.hasNext())
- {
- Property property = (Property)propertyIt.next();
- Getter getter = property.getGetter(mappedClass);
- if(getter != null && getter.getMember() != null) {
- Field field = (Field)getter.getMember();
- String getMethod = getMethodNameFromFieldName(getter.getMember().getName(),field.getType().getName());
- cmgmfc.addGetMethods(getMethod);
- }
- }
- cmgmfcList.add(cmgmfc);
- }
- return cmgmfcList;
-
- }
-
- public static String getMethodNameFromFieldName(String fieldName, String type) {
- String prefix = type != null && type.toLowerCase().endsWith("boolean") ? "is" : "get";
- String getMethod = prefix + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
- return getMethod;
- }
+ }
+
+ private void addGetters(PersistentClass persistentClass, CdmModelFieldPropertyFromClass cmgmfc) {
+ if (persistentClass != null) {
+ Iterator propertyIt = persistentClass.getPropertyIterator();
+
+ while(propertyIt.hasNext())
+ {
+ Property property = (Property)propertyIt.next();
+ Getter getter = property.getGetter(persistentClass.getMappedClass());
+ if(getter != null && getter.getMember() != null) {
+ Field field = (Field)getter.getMember();
+
+ //logger.info(" - contains field '" + field.getName() + "' of type '" + field.getType().getName() + "'");
+ cmgmfc.addGetMethods(field.getName());
+ }
+ }
+ addGetters(persistentClass.getSuperclass(), cmgmfc);
+ }
+ }
+
+
+
+ public static void main(String argv[]) {
+
+ // To re-create the serialised cdm map run,
+ // mvn exec:java -Dexec.mainClass="eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher"
+ // in the eu.etaxonomy.taxeditor.cdmlib project root dir
+ String CDM_MAP_SER_DIR = "resources/";
+
+ CdmModelCacher cdmModelCacher = new CdmModelCacher();
+ Map<String, CdmModelFieldPropertyFromClass> modelClassMap = cdmModelCacher.generateModelClassMap();
+ try{
+ FileOutputStream fout = new FileOutputStream(CDM_MAP_SER_DIR + "cdm.map.ser");
+ ObjectOutputStream oos = new ObjectOutputStream(fout);
+ oos.writeObject(modelClassMap);
+ oos.close();
+ System.out.println("CDM Map serialized");
+ }catch(Exception ex){
+ ex.printStackTrace();
+ }
+ }
}
package eu.etaxonomy.taxeditor.remoting.cache;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheException;
import net.sf.ehcache.CacheManager;
cdmlibModelCache = new Cache(modelcc);
CacheManager.create().addCache(cdmlibModelCache);
- initCdmModelCache(cdmlibModelCache);
+ CdmModelCacher cmdmc = new CdmModelCacher();
+ cmdmc.cacheGetterFields(cdmlibModelCache);
} catch (CacheException e) {
throw new CdmClientCacheException(e);
+ } catch (ClassNotFoundException e) {
+ throw new CdmClientCacheException(e);
+ } catch (IOException e) {
+ throw new CdmClientCacheException(e);
+ } catch (URISyntaxException e) {
+ throw new CdmClientCacheException(e);
}
}
- private void initCdmModelCache(final Cache cache) {
-
- initThread = new Thread() {
- @Override
- public void run(){
- synchronized (cdmlibModelCache) {
- CdmModelCacher cmdmc = new CdmModelCacher();
- cmdmc.cacheGetterFields(cache);
- cacheInitialised = true;
- logger.info("Initialisation of CDM getter fields complete");
- cdmlibModelCache.notify();
- }
- }
-
- };
- initThread.start();
- }
public Cache getCdmModelGetMethodsCache(){
- //Note : Even though we synchronize this method, the cache can be simply
- // retrieved using CacheManager.create().getCache(CDM_MODEL_CACHE_NAME)
- // in which case the cache may not be fully initialised
- synchronized (cdmlibModelCache) {
- while(!cacheInitialised) {
- try {
- logger.info("Waiting for initialisation of CDM getter fields to complete ...");
- cdmlibModelCache.wait();
- } catch (InterruptedException e) {}
- }
- }
- logger.info("CDM getter fields cache initialised");
return cdmlibModelCache;
}
}
}
}
-
-
-
}
import java.util.List;
import java.util.UUID;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
-import eu.etaxonomy.cdm.api.service.ICommonService;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils.CollectionField;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
-import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
/**
* @author cmathew
public class CachedCommonServiceImpl implements ICachedCommonService {
- @Autowired
- private ICommonService commonService;
-
private static boolean cacheEnabled = true;
- @Autowired
- private ICdmEntitySessionManager cdmEntitySessionManager;
-
-
public static boolean isCacheEnabled() {
return cacheEnabled;
}
@Override
public CdmBase find(Class<? extends CdmBase> clazz, int id) {
// if(cacheEnabled) {
- CdmBase cdmEntity = commonService.find(clazz, id, getPropertyPaths(clazz));
+ CdmBase cdmEntity = CdmApplicationState.getCurrentAppConfig().getCommonService().find(clazz, id, getPropertyPaths(clazz));
if(cdmEntity == null) {
throw new NullPointerException("CDM Entity of type " + clazz.getName() + " with id " + id + " is null.");
}
return propertyPaths;
}
- @Override
- public void updatePersistentCollection(CollectionField colf) {
- if(cacheEnabled) {
- cdmEntitySessionManager.load(colf.getCollection(), false);
- }
- }
-
/* (non-Javadoc)
* @see eu.etaxonomy.taxeditor.service.ICachedCommonService#initializeCollection(java.util.UUID, java.lang.String)
*/
@Override
public Object initializeCollection(UUID ownerUuid, String fieldName) {
- return commonService.initializeCollection(ownerUuid, fieldName, getPropertyPaths(fieldName));
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().initializeCollection(ownerUuid, fieldName, getPropertyPaths(fieldName));
}
*/
@Override
public boolean isEmpty(UUID ownerUuid, String fieldName) {
- return commonService.isEmpty(ownerUuid, fieldName);
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().isEmpty(ownerUuid, fieldName);
}
*/
@Override
public int size(UUID ownerUuid, String fieldName) {
- return commonService.size(ownerUuid, fieldName);
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().size(ownerUuid, fieldName);
}
*/
@Override
public boolean contains(UUID ownerUuid, String fieldName, Object element) {
- return commonService.contains(ownerUuid, fieldName, element);
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().contains(ownerUuid, fieldName, element);
}
*/
@Override
public boolean containsKey(UUID ownerUuid, String fieldName, Object key) {
- return commonService.containsKey(ownerUuid, fieldName, key);
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().containsKey(ownerUuid, fieldName, key);
}
*/
@Override
public boolean containsValue(UUID ownerUuid, String fieldName, Object element) {
- return commonService.containsValue(ownerUuid, fieldName, element);
+ return CdmApplicationState.getCurrentAppConfig().getCommonService().containsValue(ownerUuid, fieldName, element);
}
import java.io.OutputStream;
import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration;
import org.springframework.remoting.support.RemoteInvocation;
import org.springframework.remoting.support.RemoteInvocationResult;
import org.springframework.stereotype.Component;
+import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager;
private static final Logger logger = Logger.getLogger(CdmServiceRequestExecutor.class);
- @Autowired
- private ICdmEntitySessionManager cdmEntitySessionManager;
+ private ICdmEntitySessionManager cdmEntitySessionManager ;
private RemoteInvocation currentRemoteInvocation;
+
+
@Override
protected void writeRemoteInvocation(RemoteInvocation invocation, OutputStream os) throws IOException {
+ if(cdmEntitySessionManager == null) {
+ cdmEntitySessionManager =
+ ((CdmApplicationRemoteController)CdmApplicationState.getCurrentAppConfig()).getCdmEntitySessionManager();
+ }
currentRemoteInvocation = invocation;
super.writeRemoteInvocation(invocation, os);
}
import java.util.UUID;
import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.taxeditor.remoting.cache.ProxyUtils.CollectionField;
/**
* @author cmathew
public CdmBase find(Class<? extends CdmBase> clazz, int id);
- public void updatePersistentCollection(CollectionField colf);
/**
* Initializes a collection or map.
+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2015 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.util;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-import org.apache.log4j.Logger;
-import org.hibernate.cfg.Configuration;
-
-import eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher;
-
-/**
- * @author cmathew
- * @date 27 May 2015
- *
- */
-public class Serializer {
- private static final Logger logger = Logger.getLogger(Serializer.class);
-
-
- public static String HB_CONFIG_SER_FILE_NAME = "hibernate.cfg.ser";
-
- public static boolean checkDir(String dirString) {
- if(dirString == null || dirString.isEmpty()) {
- logger.warn("Directory not set or set to empty string");
- return false;
- }
-
- File dir = new File(dirString);
-
- if(!dir.exists()) {
- logger.warn("Directory does not exist");
- return false;
- }
-
- return true;
-
- }
- public static void serializeHbConfig() {
-
- Configuration configuration = CdmModelCacher.buildConfiguration();
- String hbConfigDir = System.getProperty("hb.config.dir");
- if(checkDir(hbConfigDir)) {
- try {
- FileOutputStream fileOut = new FileOutputStream(hbConfigDir + File.separator + HB_CONFIG_SER_FILE_NAME);
- ObjectOutputStream out = new ObjectOutputStream(fileOut);
- out.writeObject(configuration);
- out.close();
- fileOut.close();
- logger.info("Serialized configuration object");
- } catch(IOException i) {
- i.printStackTrace();
- }
- }
- }
-
- public static void main(String[] args) {
- serializeHbConfig();
-
- }
-
-}
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">\r
\r
- <context:annotation-config />\r
-\r
<import resource="classpath:/eu/etaxonomy/cdm/httpInvokerServiceClients.xml" />\r
\r
<bean id="cdmEntitySessionManager" \r
<property name="accessDecisionManager" ref="accessDecisionManager" />\r
</bean>\r
\r
- <!-- The CdmSecurityHibernateInterceptor checks onSave() and on flushDirty() \r
- if the currently authenticated principal or token has sufficient permissions \r
- on the entity to be persisted -->\r
- <bean id="securityHibernateInterceptor" \r
- class="eu.etaxonomy.cdm.persistence.hibernate.CdmSecurityHibernateInterceptor">\r
- <property name="permissionEvaluator" ref="cdmPermissionEvaluator" />\r
- </bean>\r
-\r
<bean id="authenticationManager"\r
class="org.springframework.security.authentication.ProviderManager">\r
<property name="providers">\r
<property name="userPropertyToUse" value="getUsername" />\r
</bean>\r
\r
-\r
- <bean id="cdmServiceCacher" \r
- class="eu.etaxonomy.cdm.api.cache.CdmServiceCacher" />\r
-\r
-\r
</beans>\r
+++ /dev/null
-package eu.etaxonomy.cdm.api.cache;
-
-import java.util.List;
-
-import net.sf.ehcache.Cache;
-
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Test;
-
-import eu.etaxonomy.taxeditor.remoting.cache.CdmModelCacher;
-import eu.etaxonomy.taxeditor.remoting.cache.CdmModelFieldPropertyFromClass;
-import eu.etaxonomy.taxeditor.remoting.cache.CdmRemoteCacheManager;
-
-
-public class CdmModelGetMethodCacherTest {
-
- private static final Logger logger = Logger.getLogger(CdmModelGetMethodCacherTest.class);
-
-
- @Test
- public void cacheGettersTest() {
-
- CdmModelCacher cmdmc = new CdmModelCacher();
-
- Cache cdmlibCache = CdmRemoteCacheManager.getInstance().getCdmModelGetMethodsCache();
- List<CdmModelFieldPropertyFromClass> cmgmfcList = cmdmc.getCdmModelGetMethodFromClassList();
-
- List<Object> keys = cdmlibCache.getKeys();
- Assert.assertEquals(cmgmfcList.size(), keys.size());
-
- for(CdmModelFieldPropertyFromClass cmgmfc: cmgmfcList) {
- String className = cmgmfc.getClassName();
- Assert.assertTrue(keys.contains(className));
- logger.info("Class Name : " + className + " has been cached");
- }
-
- //FIXME:Remoting do we need to test this ?
- // this will cause the following tests to fail since all caches are shutdown
- //cdmlibCache.removeAll();
- //CacheManager.create().shutdown();
- }
-
-
-
-
-}