use of org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl in project tdi-studio-se by Talend.
the class ComponentsFactory method loadComponentResource.
/**
* DOC guanglong.du Comment method "loadComponentResource".
*
* @param eclipseProject
* @return
* @throws IOException
*/
private ComponentsCache loadComponentResource(String installLocation) throws IOException {
String filePath = ComponentsFactory.TALEND_COMPONENT_CACHE + LanguageManager.getCurrentLanguage().toString().toLowerCase() + ComponentsFactory.TALEND_FILE_NAME;
URI uri = URI.createFileURI(installLocation).appendSegment(filePath);
ComponentCacheResourceFactoryImpl compFact = new ComponentCacheResourceFactoryImpl();
Resource resource = compFact.createResource(uri);
Map optionMap = new HashMap();
optionMap.put(XMLResource.OPTION_DEFER_ATTACHMENT, Boolean.TRUE);
optionMap.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);
optionMap.put(XMLResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl());
optionMap.put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap());
optionMap.put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE);
resource.load(optionMap);
ComponentsCache cache = (ComponentsCache) EcoreUtil.getObjectByType(resource.getContents(), ComponentCachePackage.eINSTANCE.getComponentsCache());
return cache;
}
Aggregations