/** * Create a index collection from a set of descriptions. * * @param descriptions * the index descriptions * @return the index collection */ public static FsIndexCollection createFsIndexCollection(FsIndexDescription... descriptions) { FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl(); fsIndexCollection.setFsIndexes(descriptions); return fsIndexCollection; }
public void addFsIndex(FsIndexDescription aFsIndexDescription) { FsIndexDescription[] current = getFsIndexes(); FsIndexDescription[] newArr = new FsIndexDescription[current.length + 1]; System.arraycopy(current, 0, newArr, 0, current.length); newArr[current.length] = aFsIndexDescription; setFsIndexes(newArr); }
public synchronized void resolveImports(ResourceManager aResourceManager) throws InvalidXMLException { resolveImports((getImports().length == 0) ? null : new TreeSet<String>(), aResourceManager); }
public synchronized void resolveImports(Collection<String> aAlreadyImportedFsIndexURLs, ResourceManager aResourceManager) throws InvalidXMLException { List<FsIndexDescription> importedIndexes = null; if (getImports().length != 0) { if (getSourceUrl() != null) { aAlreadyImportedFsIndexURLs.add(getSourceUrl().toString()); Import[] imports = getImports(); for (int i = 0; i < imports.length; i++) { ((Import_impl) imports[i]).setSourceUrlIfNull(this.getSourceUrl()); aAlreadyImportedFsIndexURLs.add(url.toString()); try { resolveImport(url, aAlreadyImportedFsIndexURLs, importedIndexes, aResourceManager); } catch (IOException e) { throw new InvalidXMLException(InvalidXMLException.IMPORT_FAILED_COULD_NOT_READ_FROM_URL, FsIndexDescription[] existingIndexes = this.getFsIndexes(); if (existingIndexes == null) { this.setFsIndexes(existingIndexes = FsIndexDescription.EMPTY_FS_INDEX_DESCRIPTIONS); newIndexes[existingIndexes.length + i] = importedIndexes.get(i); this.setFsIndexes(newIndexes); this.setImports(Import.EMPTY_IMPORTS);
/** * @see org.apache.uima.analysis_engine.metadata.AnalysisEngineMetaData#setFsIndexes(FsIndexDescription[]) */ public void setFsIndexes(FsIndexDescription[] aFsIndexes) { if (mFsIndexCollection == null) { mFsIndexCollection = new FsIndexCollection_impl(); } mFsIndexCollection.setFsIndexes(aFsIndexes); }
FsIndexCollection_impl fsIndexCollection = new FsIndexCollection_impl(); fsIndexCollection.addFsIndex(createFsIndexDescription(anIdx.label(), anIdx.kind(), typeName, anIdx.typePriorities(), keys.toArray(new FsIndexKeyDescription[keys.size()])));
/** * Creates a {@link FsIndexCollection} from descriptor names. * * @param descriptorNames * The fully qualified, Java-style, dotted descriptor names. * @return a {@link FsIndexCollection} that includes the indexes from all of the specified files. */ public static FsIndexCollection createFsIndexCollection(String... descriptorNames) { List<Import> imports = new ArrayList<Import>(); for (String descriptorName : descriptorNames) { Import imp = new Import_impl(); imp.setName(descriptorName); imports.add(imp); } Import[] importArray = new Import[imports.size()]; FsIndexCollection fsIndexCollection = new FsIndexCollection_impl(); fsIndexCollection.setImports(imports.toArray(importArray)); return fsIndexCollection; }
public void removeFsIndex(FsIndexDescription aFsIndexDescription) { FsIndexDescription[] current = getFsIndexes(); for (int i = 0; i < current.length; i++) { if (current[i] == aFsIndexDescription) { FsIndexDescription[] newArr = new FsIndexDescription[current.length - 1]; System.arraycopy(current, 0, newArr, 0, i); System.arraycopy(current, i + 1, newArr, i, current.length - i - 1); setFsIndexes(newArr); break; } } }
/** * Creates a {@link FsIndexCollection} from a descriptor file * * @param descriptorURIs * The descriptor file paths. * @return A {@link FsIndexCollection} that includes the indexes from all of the specified files. */ public static FsIndexCollection createTypeSystemDescriptionFromPath(String... descriptorURIs) { List<Import> imports = new ArrayList<Import>(); for (String descriptorURI : descriptorURIs) { Import imp = new Import_impl(); imp.setLocation(descriptorURI); imports.add(imp); } Import[] importArray = new Import[imports.size()]; FsIndexCollection fsIndexCollection = new FsIndexCollection_impl(); fsIndexCollection.setImports(imports.toArray(importArray)); return fsIndexCollection; }
public synchronized void resolveImports() throws InvalidXMLException { if (getImports().length == 0) { resolveImports(null, null); } else { resolveImports(new TreeSet<String>(), UIMAFramework.newDefaultResourceManager()); } }