use of org.alfresco.opencmis.dictionary.QNameFilter in project SearchServices by Alfresco.
the class AlfrescoSolrDataModel method getQNameFilter.
/**
* TODO: Fix to load type filter/exclusions from somewhere sensible
* @return QNameFilter
*/
private QNameFilter getQNameFilter() {
QNameFilter qnameFilter = null;
FileSystemXmlApplicationContext ctx = null;
File resourceDirectory = getResourceDirectory();
// If we ever need to filter out models in the future, then we must put a filter somewhere.
// Currently, we do not need to filter any models, so this filter does not exist.
File filterContext = new File(resourceDirectory, "opencmis-qnamefilter-context.xml");
if (!filterContext.exists()) {
log.info("No type filter context found at " + filterContext.getAbsolutePath() + ", no type filtering");
return qnameFilter;
}
try {
ctx = new FileSystemXmlApplicationContext(new String[] { "file:" + filterContext.getAbsolutePath() }, false);
ctx.setClassLoader(this.getClass().getClassLoader());
ctx.refresh();
qnameFilter = (QNameFilter) ctx.getBean("cmisTypeExclusions");
if (qnameFilter == null) {
log.warn("Unable to find type filter at " + filterContext.getAbsolutePath() + ", no type filtering");
}
} catch (BeansException e) {
log.warn("Unable to parse type filter at " + filterContext.getAbsolutePath() + ", no type filtering");
} finally {
if (ctx != null && ctx.getBeanFactory() != null && ctx.isActive()) {
ctx.close();
}
}
return qnameFilter;
}
Aggregations