private static XMLInputSource resolveImportByName(String aFileResource, ResourceManager aResourceManager) throws InvalidXMLException, ResourceInitializationException, IOException { XMLInputSource input; if (aFileResource.startsWith(IMPORT_BY_NAME_PREFIX)) { Import theImport = new Import_impl(); theImport.setName(aFileResource.substring(IMPORT_BY_NAME_PREFIX.length())); input = new XMLInputSource(theImport.findAbsoluteUrl(aResourceManager)); } else { input = new XMLInputSource(aFileResource); } return input; }
imp.setName(fileName.substring(partStart)); try { imp.findAbsoluteUrl(rm); } catch (InvalidXMLException e) { partStart = fileName.indexOf('.', partStart) + 1;
try { if (mImport != null) { return mImport.findAbsoluteUrl(aResourceManager);
private String resolveToAbsolutePath(Import theImport) { ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager(); try { return theImport.findAbsoluteUrl(resourceManager).toExternalForm(); } catch (Exception e) { if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) { UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, WarmUpDataProvider.class.getName(), "resolveToAbsolutePath", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__WARNING", e); } return "ERROR converting import by name to absolute path"; } }
/** * Gets the absolute UR lfrom import. * * @param importItem the import item * @return the absolute UR lfrom import */ private URL getAbsoluteURLfromImport(Import importItem) { try { // if by location, it's relative to the descriptor. return Platform.asLocalURL(importItem.findAbsoluteUrl(createResourceManager())); } catch (InvalidXMLException ex) { ex.printStackTrace(); } catch (IOException e) { } return null; }
URL url = aeImport.findAbsoluteUrl(aResourceManager);
if (isImportByName) { try { byNameURL = imp.findAbsoluteUrl(editor.createResourceManager()); } catch (InvalidXMLException e) { showExceptionReadingImportedDescriptor(e);
public static String resolveByName(String input) { ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager(); Import theImport = new Import_impl(); theImport.setName(input); try { return theImport.findAbsoluteUrl(resourceManager).toExternalForm(); } catch (InvalidXMLException e) { if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.SEVERE)) { UIMAFramework.getLogger(CLASS_NAME).logrb(Level.SEVERE, XsltImportByName.class.getName(), "resolveByName", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE, "UIMAEE_exception__SEVERE", e.toString()); } return null; } }
URL url = imports[i].findAbsoluteUrl(aResourceManager); if (!aAlreadyImportedTypePrioritiesURLs.contains(url.toString())) { aAlreadyImportedTypePrioritiesURLs.add(url.toString());
((Import_impl) imports[i]).setSourceUrlIfNull(this.getSourceUrl()); URL url = imports[i].findAbsoluteUrl(aResourceManager); if (!aAlreadyImportedTypeSystemURLs.contains(url.toString())) { aAlreadyImportedTypeSystemURLs.add(url.toString());
((Import_impl) imports[i]).setSourceUrlIfNull(this.getSourceUrl()); URL url = imports[i].findAbsoluteUrl(aResourceManager); if (!aAlreadyImportedURLs.contains(url.toString())) { aAlreadyImportedURLs.add(url.toString());
URL url = imports[i].findAbsoluteUrl(aResourceManager); if (!aAlreadyImportedFsIndexURLs.contains(url.toString())) { aAlreadyImportedFsIndexURLs.add(url.toString());
public synchronized void resolveImports(ResourceManager aResourceManager) throws InvalidXMLException { Import theImport = getImport(); if (theImport != null) { URL url = theImport.findAbsoluteUrl(aResourceManager); InputStream stream = null; try { stream = url.openStream(); XMLInputSource input = new XMLInputSource(url); ResourceSpecifier spec = UIMAFramework.getXMLParser().parseResourceSpecifier(input); setSpecifier(spec); setImport(null); } catch (IOException e) { throw new InvalidXMLException(e); } finally { try { if (stream != null) { stream.close(); } } catch (IOException e1) { UIMAFramework.getLogger(this.getClass()).log(Level.SEVERE, "", e1); } } } }
} else { Import aedImport = (Import) mdo; URL aedUrl = aedImport.findAbsoluteUrl(UIMAFramework.newDefaultResourceManager()); d = (AnalysisEngineDescription) createResourceCreationSpecifier(aedUrl, null);
/** * Get a CollectionReader from the name (Java-style, dotted) of an XML descriptor file, and a set * of configuration parameters. * * @param descriptorName * The fully qualified, Java-style, dotted name of the XML descriptor file. * @param configurationData * Any additional configuration parameters to be set. These should be supplied as (name, * value) pairs, so there should always be an even number of parameters. * @return The AnalysisEngine created from the XML descriptor and the configuration parameters. * @throws UIMAException * if the descriptor could not be created or if the component could not be instantiated * @throws IOException * if the descriptor could not be read */ public static CollectionReader createReader(String descriptorName, Object... configurationData) throws UIMAException, IOException { Import imp = UIMAFramework.getResourceSpecifierFactory().createImport(); imp.setName(descriptorName); URL url = imp.findAbsoluteUrl(ResourceManagerFactory.newResourceManager()); ResourceSpecifier specifier = createResourceCreationSpecifier(url, configurationData); return UIMAFramework.produceCollectionReader(specifier, ResourceManagerFactory.newResourceManager(), null); }