public synchronized void resolveImports(ResourceManager aResourceManager) throws InvalidXMLException { resolveImports((getImports().length == 0) ? null : new TreeSet<String>(), aResourceManager); }
/** * Overridden to supress <priorityLists> tag for TAF compatibility * * @see MetaDataObject_impl#writePropertyAsElement(org.apache.uima.resource.metadata.impl.PropertyXmlInfo, * java.lang.String) */ @Override protected void writePropertyAsElement(PropertyXmlInfo aPropInfo, String aNamespace) throws SAXException { if ("priorityLists".equals(aPropInfo.propertyName)) { // call writeArrayPropertyAsElement directly, which will not generate the // <priorityLists> tag writeArrayPropertyAsElement(aPropInfo.propertyName, TypePriorityList[].class, getPriorityLists(), null, aNamespace); } else // normal handling { super.writePropertyAsElement(aPropInfo, aNamespace); } }
public synchronized void resolveImports(Collection<String> aAlreadyImportedTypePrioritiesURLs, ResourceManager aResourceManager) throws InvalidXMLException { List<TypePriorityList> importedPriorityLists = null; if (getImports().length != 0) { if (getSourceUrl() != null) { aAlreadyImportedTypePrioritiesURLs.add(getSourceUrl().toString()); Import[] imports = getImports(); for (int i = 0; i < imports.length; i++) { ((Import_impl) imports[i]).setSourceUrlIfNull(this.getSourceUrl()); aAlreadyImportedTypePrioritiesURLs.add(url.toString()); try { resolveImport(url, aAlreadyImportedTypePrioritiesURLs, importedPriorityLists, aResourceManager); } catch (IOException e) { TypePriorityList[] existingPriorityLists = this.getPriorityLists(); if (existingPriorityLists == null) { this.setPriorityLists(existingPriorityLists = TypePriorityList.EMPTY_TYPE_PRIORITY_LISTS); .get(i); this.setPriorityLists(newPriorityLists); this.setImports(Import.EMPTY_IMPORTS);
public Object clone() { TypePriorities_impl clone = (TypePriorities_impl) super.clone(); clone.mPriorityLists = new ArrayList<TypePriorityList>(); final List<TypePriorityList> origPriorityLists = mPriorityLists; synchronized (origPriorityLists) { // saw concurrent mod exceptions while iterating on this 3/2014 for (TypePriorityList priList : origPriorityLists) { clone.addPriorityList((TypePriorityList) priList.clone()); } } return clone; }
/** * Create a TypePriorities given a sequence of ordered type names * * @param prioritizedTypeNames * a sequence of ordered type names * @return type priorities created from the ordered type names */ public static TypePriorities createTypePriorities(String... prioritizedTypeNames) { TypePriorities typePriorities = new TypePriorities_impl(); TypePriorityList typePriorityList = typePriorities.addPriorityList(); for (String typeName : prioritizedTypeNames) { typePriorityList.addType(typeName); } return typePriorities; }
/** * @see TypeSystemDescription#resolveImports() */ // support multithreading, // avoid object creation if already resolved public synchronized void resolveImports() throws InvalidXMLException { if (getImports().length == 0) { resolveImports(null, null); } else { resolveImports(new TreeSet<String>(), UIMAFramework.newDefaultResourceManager()); } }