use of org.alfresco.opencmis.mapping.CMISMapping in project SearchServices by Alfresco.
the class AlfrescoClientDataModelServicesFactory method newInstanceOfExcludedCMISMapping.
private static CMISMapping newInstanceOfExcludedCMISMapping(CMISMapping cmisMapping, QNameFilter filter) {
CMISMapping cmisMappingWithExcl = new CMISMapping();
cmisMappingWithExcl.setNamespaceService(cmisMapping.getNamespaceService());
cmisMappingWithExcl.setDictionaryService(cmisMapping.getDictionaryService());
cmisMappingWithExcl.setFilter(filter);
cmisMappingWithExcl.setCmisVersion(cmisMapping.getCmisVersion());
cmisMappingWithExcl.afterPropertiesSet();
return cmisMappingWithExcl;
}
use of org.alfresco.opencmis.mapping.CMISMapping in project SearchServices by Alfresco.
the class AlfrescoClientDataModelServicesFactory method constructDictionaries.
/**
* Constructs a dictionary by default.
*
* @param qnameFilter QNameFilter
* @param namespaceDAO NamespaceDAO
* @param dictionaryService DictionaryComponent
* @param dictionaryDAO DictionaryDAO
* @return Map
*/
public static Map<DictionaryKey, CMISAbstractDictionaryService> constructDictionaries(QNameFilter qnameFilter, NamespaceDAO namespaceDAO, DictionaryComponent dictionaryService, DictionaryDAO dictionaryDAO) {
DictionaryNamespaceComponent namespaceService = new DictionaryNamespaceComponent();
namespaceService.setNamespaceDAO(namespaceDAO);
CMISMapping cmisMapping = new CMISMapping();
cmisMapping.setCmisVersion(CmisVersion.CMIS_1_0);
cmisMapping.setFilter(qnameFilter);
cmisMapping.setNamespaceService(namespaceService);
cmisMapping.setDictionaryService(dictionaryService);
cmisMapping.afterPropertiesSet();
CMISMapping cmisMapping11 = new CMISMapping();
cmisMapping11.setCmisVersion(CmisVersion.CMIS_1_1);
cmisMapping11.setFilter(qnameFilter);
cmisMapping11.setNamespaceService(namespaceService);
cmisMapping11.setDictionaryService(dictionaryService);
cmisMapping11.afterPropertiesSet();
Map<DictionaryKey, CMISAbstractDictionaryService> dictionaries = new HashMap<DictionaryKey, CMISAbstractDictionaryService>();
DictionaryKey key = new DictionaryKey(CmisVersion.CMIS_1_0, CMISStrictDictionaryService.DEFAULT);
dictionaries.put(key, newInstance(cmisMapping, dictionaryService, dictionaryDAO));
CMISMapping mappingWithExclusions = newInstanceOfExcludedCMISMapping(cmisMapping, qnameFilter);
key = new DictionaryKey(CmisVersion.CMIS_1_0, DICTIONARY_FILTERED_WITH_EXCLUSIONS);
dictionaries.put(key, newInstance(mappingWithExclusions, dictionaryService, dictionaryDAO));
key = new DictionaryKey(CmisVersion.CMIS_1_1, CMISStrictDictionaryService.DEFAULT);
dictionaries.put(key, newInstance(cmisMapping11, dictionaryService, dictionaryDAO));
CMISMapping mappingWithExclusions11 = newInstanceOfExcludedCMISMapping(cmisMapping11, qnameFilter);
key = new DictionaryKey(CmisVersion.CMIS_1_1, DICTIONARY_FILTERED_WITH_EXCLUSIONS);
dictionaries.put(key, newInstance(mappingWithExclusions11, dictionaryService, dictionaryDAO));
return dictionaries;
}
use of org.alfresco.opencmis.mapping.CMISMapping 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();
}
}
Aggregations