@Test public void testGenerate() throws Exception { outDir = new File(rootDirectory + "src/test/resources/test-generate"); outDir.mkdirs(); GenerateDescriptors.generate(ExampleWhitespaceTokenizer.class.getCanonicalName(), outDir.getAbsolutePath()); File destDir = new File(outDir, "gov/va/vinci/leo/ae"); File[] files = destDir.listFiles(); assertNotNull(files); assertEquals(2, files.length); String descriptorText = FileUtils.readFileToString(new File(destDir, "ExampleWhitespaceTokenizerDescriptor.xml")); assertTrue(StringUtils.isNotBlank(descriptorText)); assertTrue(descriptorText.contains("analysisEngineDescription")); }
public static void generate(String annotatorClassName, String outputRootPath) throws Exception { LeoBaseAnnotator annotator = (LeoBaseAnnotator) Class.forName(annotatorClassName).newInstance(); String shortName = annotatorClassName; if (annotatorClassName.contains(".")) { shortName = annotatorClassName.substring(annotatorClassName.lastIndexOf(".") + 1); } String newOutputPath = outputRootPath; if (!outputRootPath.endsWith(File.separator)) { newOutputPath += File.separator; } if (annotatorClassName.contains(".")) { newOutputPath += annotatorClassName.substring(0, annotatorClassName.lastIndexOf(".")).replaceAll("\\.", File.separator) + File.separator; } FileUtils.forceMkdir(new File(newOutputPath)); annotator.getLeoTypeSystemDescription().toXML(newOutputPath + shortName + "Type.xml"); LeoAEDescriptor desc = (LeoAEDescriptor) annotator.getDescriptor(); desc.toXML(shortName); String descriptorPath = desc.getDescriptorLocator(); if (descriptorPath.startsWith("file:")) { descriptorPath = descriptorPath.substring(5); } FileUtils.copyFile(new File(descriptorPath), new File(newOutputPath + shortName + "Descriptor.xml")); }
GenerateDescriptors { public static void generate(String annotatorClassName, String outputRootPath) throws Exception { LeoBaseAnnotator annotator = (LeoBaseAnnotator) Class.forName(annotatorClassName).newInstance(); String shortName = annotatorClassName; if (annotatorClassName.contains(".")) { shortName = annotatorClassName.substring(annotatorClassName.lastIndexOf(".") + 1); } String newOutputPath = outputRootPath; if (!outputRootPath.endsWith(File.separator)) { newOutputPath += File.separator; } if (annotatorClassName.contains(".")) { newOutputPath += annotatorClassName.substring(0, annotatorClassName.lastIndexOf(".")).replaceAll("\\.", File.separator) + File.separator; } FileUtils.forceMkdir(new File(newOutputPath)); annotator.getLeoTypeSystemDescription().toXML(newOutputPath + shortName + "Type.xml"); LeoAEDescriptor desc = (LeoAEDescriptor) annotator.getDescriptor(); desc.toXML(shortName); String descriptorPath = desc.getDescriptorLocator(); if (descriptorPath.startsWith("file:")) { descriptorPath = descriptorPath.substring(5); } FileUtils.copyFile(new File(descriptorPath), new File(newOutputPath + shortName + "Descriptor.xml")); } }
GenerateDescriptors { public static void generate(String annotatorClassName, String outputRootPath) throws Exception { LeoBaseAnnotator annotator = (LeoBaseAnnotator) Class.forName(annotatorClassName).newInstance(); String shortName = annotatorClassName; if (annotatorClassName.contains(".")) { shortName = annotatorClassName.substring(annotatorClassName.lastIndexOf(".") + 1); } String newOutputPath = outputRootPath; if (!outputRootPath.endsWith(File.separator)) { newOutputPath += File.separator; } if (annotatorClassName.contains(".")) { newOutputPath += annotatorClassName.substring(0, annotatorClassName.lastIndexOf(".")).replaceAll("\\.", File.separator) + File.separator; } FileUtils.forceMkdir(new File(newOutputPath)); annotator.getLeoTypeSystemDescription().toXML(newOutputPath + shortName + "Type.xml"); LeoAEDescriptor desc = (LeoAEDescriptor) annotator.getDescriptor(); desc.toXML(shortName); String descriptorPath = desc.getDescriptorLocator(); if (descriptorPath.startsWith("file:")) { descriptorPath = descriptorPath.substring(5); } FileUtils.copyFile(new File(descriptorPath), new File(newOutputPath + shortName + "Descriptor.xml")); }  }
GenerateDescriptors { public static void generate(String annotatorClassName, String outputRootPath) throws Exception { LeoBaseAnnotator annotator = (LeoBaseAnnotator) Class.forName(annotatorClassName).newInstance(); String shortName = annotatorClassName; if (annotatorClassName.contains(".")) { shortName = annotatorClassName.substring(annotatorClassName.lastIndexOf(".") + 1); } String newOutputPath = outputRootPath; if (!outputRootPath.endsWith(File.separator)) { newOutputPath += File.separator; } if (annotatorClassName.contains(".")) { newOutputPath += annotatorClassName.substring(0, annotatorClassName.lastIndexOf(".")).replaceAll("\\.", File.separator) + File.separator; } FileUtils.forceMkdir(new File(newOutputPath)); annotator.getLeoTypeSystemDescription().toXML(newOutputPath + shortName + "Type.xml"); LeoAEDescriptor desc = (LeoAEDescriptor) annotator.getDescriptor(); desc.toXML(shortName); String descriptorPath = desc.getDescriptorLocator(); if (descriptorPath.startsWith("file:")) { descriptorPath = descriptorPath.substring(5); } FileUtils.copyFile(new File(descriptorPath), new File(newOutputPath + shortName + "Descriptor.xml")); }  static void main(String[] args); static void generate(String annotatorClassName, String outputRootPath); }
GenerateDescriptors { public static void generate(String annotatorClassName, String outputRootPath) throws Exception { LeoBaseAnnotator annotator = (LeoBaseAnnotator) Class.forName(annotatorClassName).newInstance(); String shortName = annotatorClassName; if (annotatorClassName.contains(".")) { shortName = annotatorClassName.substring(annotatorClassName.lastIndexOf(".") + 1); } String newOutputPath = outputRootPath; if (!outputRootPath.endsWith(File.separator)) { newOutputPath += File.separator; } if (annotatorClassName.contains(".")) { newOutputPath += annotatorClassName.substring(0, annotatorClassName.lastIndexOf(".")).replaceAll("\\.", File.separator) + File.separator; } FileUtils.forceMkdir(new File(newOutputPath)); annotator.getLeoTypeSystemDescription().toXML(newOutputPath + shortName + "Type.xml"); LeoAEDescriptor desc = (LeoAEDescriptor) annotator.getDescriptor(); desc.toXML(shortName); String descriptorPath = desc.getDescriptorLocator(); if (descriptorPath.startsWith("file:")) { descriptorPath = descriptorPath.substring(5); } FileUtils.copyFile(new File(descriptorPath), new File(newOutputPath + shortName + "Descriptor.xml")); }  static void main(String[] args); static void generate(String annotatorClassName, String outputRootPath);  }