script += rule;
URL aedesc = RutaEngine.class.getResource("BasicEngine.xml");
XMLInputSource inae = new XMLInputSource(aedesc);
ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(inae);
ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
AnalysisEngineDescription aed = (AnalysisEngineDescription) specifier;
TypeSystemDescription basicTypeSystem = aed.getAnalysisEngineMetaData().getTypeSystem();
if (!typeSystemLocation.equals("")) {
String tsLocation = typeSystemLocation;
Collection<TypeSystemDescription> tsds = new ArrayList<TypeSystemDescription>();
tsds.add(basicTypeSystem);
if (typeSystemLocation.endsWith(".ruta")) {
IFile iFile = RutaAddonsPlugin.getIFile(typeSystemLocation);
IPath scriptPath = iFile.getLocation();
IProject project = iFile.getProject();
IPath descriptorRootPath = RutaProjectUtils.getDescriptorRootPath(project);
resMgr.setDataPath(descriptorRootPath.toPortableString());
IPath path = RutaProjectUtils.getTypeSystemDescriptorPath(scriptPath, project);
tsLocation = path.toPortableString();
}
File tsFile = new File(tsLocation);
XMLInputSource ints = new XMLInputSource(tsFile);
TypeSystemDescription importTSD = UIMAFramework.getXMLParser().parseTypeSystemDescription(
ints);
importTSD.resolveImports(resMgr);
tsds.add(importTSD);
TypeSystemDescription mergeTypeSystems = CasCreationUtils.mergeTypeSystems(tsds);
aed.getAnalysisEngineMetaData().setTypeSystem(mergeTypeSystems);
}
aed.resolveImports(resMgr);
ae = UIMAFramework.produceAnalysisEngine(aed, resMgr, null);
File tempFile = File.createTempFile("RutaRuta", RutaEngine.SCRIPT_FILE_EXTENSION);
tempFile.deleteOnExit();
FileUtils.saveString2File(script, tempFile, "UTF-8");
String portableString = Path.fromOSString(tempFile.getParentFile().getPath())