Search in sources :

Example 1 with RuntimePropertyLuceneBuilderMapping

use of org.alfresco.opencmis.mapping.RuntimePropertyLuceneBuilderMapping in project SearchServices by Alfresco.

the class AlfrescoClientDataModelServicesFactory method newInstance.

protected static CMISStrictDictionaryService newInstance(CMISMapping cmisMapping, DictionaryService dictionaryService, DictionaryDAO dictionaryDAO) {
    CMISStrictDictionaryService cmisDictionaryService = new CMISStrictDictionaryService();
    cmisDictionaryService.setCmisMapping(cmisMapping);
    cmisDictionaryService.setDictionaryService(dictionaryService);
    cmisDictionaryService.setDictionaryDAO(dictionaryDAO);
    cmisDictionaryService.setSingletonCache(new MemoryCache<String, CMISDictionaryRegistry>());
    RuntimePropertyLuceneBuilderMapping luceneBuilderMapping = new RuntimePropertyLuceneBuilderMapping();
    luceneBuilderMapping.setDictionaryService(dictionaryService);
    luceneBuilderMapping.setCmisDictionaryService(cmisDictionaryService);
    cmisDictionaryService.setPropertyLuceneBuilderMapping(luceneBuilderMapping);
    luceneBuilderMapping.afterPropertiesSet();
    cmisDictionaryService.init();
    return cmisDictionaryService;
}
Also used : CMISStrictDictionaryService(org.alfresco.opencmis.dictionary.CMISStrictDictionaryService) RuntimePropertyLuceneBuilderMapping(org.alfresco.opencmis.mapping.RuntimePropertyLuceneBuilderMapping) CMISDictionaryRegistry(org.alfresco.opencmis.dictionary.CMISDictionaryRegistry)

Example 2 with RuntimePropertyLuceneBuilderMapping

use of org.alfresco.opencmis.mapping.RuntimePropertyLuceneBuilderMapping in project SearchServices by Alfresco.

the class SOLRAPIClientTest method setUp.

@Override
public void setUp() throws Exception {
    if (client == null) {
        TenantService tenantService = new SingleTServiceImpl();
        dictionaryDAO = new DictionaryDAOImpl();
        NamespaceDAO namespaceDAO = dictionaryDAO;
        dictionaryDAO.setTenantService(tenantService);
        CompiledModelsCache compiledModelsCache = new CompiledModelsCache();
        compiledModelsCache.setDictionaryDAO(dictionaryDAO);
        compiledModelsCache.setTenantService(tenantService);
        compiledModelsCache.setRegistry(new DefaultAsynchronouslyRefreshedCacheRegistry());
        TraceableThreadFactory threadFactory = new TraceableThreadFactory();
        threadFactory.setThreadDaemon(true);
        threadFactory.setThreadPriority(Thread.NORM_PRIORITY);
        ThreadPoolExecutor threadPoolExecutor = new DynamicallySizedThreadPoolExecutor(20, 20, 90, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), threadFactory, new ThreadPoolExecutor.CallerRunsPolicy());
        compiledModelsCache.setThreadPoolExecutor(threadPoolExecutor);
        dictionaryDAO.setDictionaryRegistryCache(compiledModelsCache);
        dictionaryDAO.setResourceClassLoader(getResourceClassLoader());
        dictionaryDAO.init();
        DictionaryComponent dictionaryComponent = new DictionaryComponent();
        dictionaryComponent.setDictionaryDAO(dictionaryDAO);
        dictionaryComponent.setMessageLookup(new StaticMessageLookup());
        // cmis dictionary
        CMISMapping cmisMapping = new CMISMapping();
        cmisMapping.setCmisVersion(CmisVersion.CMIS_1_0);
        DictionaryNamespaceComponent namespaceService = new DictionaryNamespaceComponent();
        namespaceService.setNamespaceDAO(namespaceDAO);
        cmisMapping.setNamespaceService(namespaceService);
        cmisMapping.setDictionaryService(dictionaryComponent);
        cmisMapping.afterPropertiesSet();
        cmisDictionaryService = new CMISStrictDictionaryService();
        cmisDictionaryService.setCmisMapping(cmisMapping);
        cmisDictionaryService.setDictionaryService(dictionaryComponent);
        cmisDictionaryService.setDictionaryDAO(dictionaryDAO);
        cmisDictionaryService.setSingletonCache(new MemoryCache<String, CMISDictionaryRegistry>());
        cmisDictionaryService.setTenantService(tenantService);
        cmisDictionaryService.init();
        RuntimePropertyLuceneBuilderMapping luceneBuilderMapping = new RuntimePropertyLuceneBuilderMapping();
        luceneBuilderMapping.setDictionaryService(dictionaryComponent);
        luceneBuilderMapping.setCmisDictionaryService(cmisDictionaryService);
        cmisDictionaryService.setPropertyLuceneBuilderMapping(luceneBuilderMapping);
        luceneBuilderMapping.afterPropertiesSet();
        // Load the key store from the classpath
        ClasspathKeyResourceLoader keyResourceLoader = new ClasspathKeyResourceLoader();
        client = new SOLRAPIClient(getRepoClient(keyResourceLoader), dictionaryComponent, dictionaryDAO);
        trackModels();
    }
}
Also used : NamespaceDAO(org.alfresco.repo.dictionary.NamespaceDAO) CMISMapping(org.alfresco.opencmis.mapping.CMISMapping) DictionaryDAOImpl(org.alfresco.repo.dictionary.DictionaryDAOImpl) RuntimePropertyLuceneBuilderMapping(org.alfresco.opencmis.mapping.RuntimePropertyLuceneBuilderMapping) DefaultAsynchronouslyRefreshedCacheRegistry(org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry) SingleTServiceImpl(org.alfresco.repo.tenant.SingleTServiceImpl) CMISDictionaryRegistry(org.alfresco.opencmis.dictionary.CMISDictionaryRegistry) TraceableThreadFactory(org.alfresco.util.TraceableThreadFactory) CMISStrictDictionaryService(org.alfresco.opencmis.dictionary.CMISStrictDictionaryService) TenantService(org.alfresco.repo.tenant.TenantService) DynamicallySizedThreadPoolExecutor(org.alfresco.util.DynamicallySizedThreadPoolExecutor) DictionaryComponent(org.alfresco.repo.dictionary.DictionaryComponent) DictionaryNamespaceComponent(org.alfresco.repo.dictionary.DictionaryNamespaceComponent) StaticMessageLookup(org.alfresco.repo.i18n.StaticMessageLookup) CompiledModelsCache(org.alfresco.repo.dictionary.CompiledModelsCache) DynamicallySizedThreadPoolExecutor(org.alfresco.util.DynamicallySizedThreadPoolExecutor) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor)

Aggregations

CMISDictionaryRegistry (org.alfresco.opencmis.dictionary.CMISDictionaryRegistry)2 CMISStrictDictionaryService (org.alfresco.opencmis.dictionary.CMISStrictDictionaryService)2 RuntimePropertyLuceneBuilderMapping (org.alfresco.opencmis.mapping.RuntimePropertyLuceneBuilderMapping)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 CMISMapping (org.alfresco.opencmis.mapping.CMISMapping)1 CompiledModelsCache (org.alfresco.repo.dictionary.CompiledModelsCache)1 DictionaryComponent (org.alfresco.repo.dictionary.DictionaryComponent)1 DictionaryDAOImpl (org.alfresco.repo.dictionary.DictionaryDAOImpl)1 DictionaryNamespaceComponent (org.alfresco.repo.dictionary.DictionaryNamespaceComponent)1 NamespaceDAO (org.alfresco.repo.dictionary.NamespaceDAO)1 StaticMessageLookup (org.alfresco.repo.i18n.StaticMessageLookup)1 SingleTServiceImpl (org.alfresco.repo.tenant.SingleTServiceImpl)1 TenantService (org.alfresco.repo.tenant.TenantService)1 DynamicallySizedThreadPoolExecutor (org.alfresco.util.DynamicallySizedThreadPoolExecutor)1 TraceableThreadFactory (org.alfresco.util.TraceableThreadFactory)1 DefaultAsynchronouslyRefreshedCacheRegistry (org.alfresco.util.cache.DefaultAsynchronouslyRefreshedCacheRegistry)1