Fixes for ALFCOM-2942 (after the addition of subsystems etc in 3.2)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14530 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind 2009-06-04 11:25:37 +00:00
parent 8343b2a642
commit dc74e02dfb
3 changed files with 20 additions and 10 deletions

View File

@ -34,8 +34,9 @@ import org.aopalliance.intercept.MethodInvocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.ListableBeanFactory;
/**
* Identify public services by method invocation. Look ups are cached on a thread local as they are quite expensive. All public service names end with "Service" and start with
@ -43,24 +44,28 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
*
* @author Andy Hind
*/
public class PublicServiceIdentifierImpl implements PublicServiceIdentifier, BeanFactoryPostProcessor
public class PublicServiceIdentifierImpl implements PublicServiceIdentifier, BeanFactoryAware
{
private static Log s_logger = LogFactory.getLog(PublicServiceIdentifierImpl.class);
private static ThreadLocal<HashMap<Method, String>> methodToServiceMap = new ThreadLocal<HashMap<Method, String>>();
private ConfigurableListableBeanFactory beanFactory;
private ListableBeanFactory beanFactory;
public PublicServiceIdentifierImpl()
{
super();
}
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
{
this.beanFactory = beanFactory;
this.beanFactory = (ListableBeanFactory)beanFactory;
}
public String getPublicServiceName(MethodInvocation mi)
{
return getServiceName(mi);

View File

@ -25,14 +25,14 @@
package org.alfresco.repo.search.impl.lucene.fts;
import org.alfresco.service.cmr.repository.StoreRef;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.BeanFactoryAware;
/**
* API for full text search indexing in the background
*
* @author andyh
*/
public interface FullTextSearchIndexer extends BeanFactoryPostProcessor
public interface FullTextSearchIndexer extends BeanFactoryAware
{
/**
* Mark a store as dirty, requiring a background index update to fix it up.

View File

@ -34,6 +34,8 @@ import org.alfresco.repo.search.IndexerAndSearcher;
import org.alfresco.repo.search.SupportsBackgroundIndexing;
import org.alfresco.service.cmr.repository.StoreRef;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -243,10 +245,13 @@ public class FullTextSearchIndexerImpl implements FTSIndexerAware, FullTextSearc
ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
}
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
{
ListableBeanFactory listableBeanFactory = (ListableBeanFactory)beanFactory;
// Find bean implementaing SupportsBackgroundIndexing and register
for(Object bgindexable : beanFactory.getBeansOfType(SupportsBackgroundIndexing.class).values())
for(Object bgindexable : listableBeanFactory.getBeansOfType(SupportsBackgroundIndexing.class).values())
{
if(bgindexable instanceof SupportsBackgroundIndexing)
{