Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceManager


      }
      assertNotNull(ex);
      assertEquals(6, ts.getTypes().length); // should be no side effects when exception is thrown

      // set data path correctly and it should work
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      resMgr.setDataPath(JUnitExtension.getFile("TypeSystemDescriptionImplTest/dataPathDir")
              .getAbsolutePath());
      ts.resolveImports(resMgr);

      types = ts.getTypes();
      assertEquals(13, types.length);
View Full Code Here


      assertNotNull(ex);
      assertEquals(2, ic.getFsIndexes().length); // should be no side effects when exception is
      // thrown

      // set data path correctly and it should work
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      resMgr.setDataPath(JUnitExtension.getFile("FsIndexCollectionImplTest/dataPathDir")
              .getAbsolutePath());
      ic.resolveImports(resMgr);

      indexes = ic.getFsIndexes();
      assertEquals(4, indexes.length);
View Full Code Here

      final String TEST_DATAPATH = JUnitExtension.getFile("AnnotatorContextTest").getPath();

      File descFile = JUnitExtension.getFile("ResourceManagerImplTest/ResourceTestAggregate.xml");
      AnalysisEngineDescription desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(
              new XMLInputSource(descFile));
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      resMgr.setDataPath(TEST_DATAPATH);
      UIMAFramework.produceAnalysisEngine(desc, resMgr, null);

      URL url = resMgr.getResourceURL("/Annotator1/TestFileResource");
      assertTrue(url.toString().endsWith("testDataFile2.dat"));
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

      // name import
      importObj = new Import_impl();
      importObj.setName("TypeSystemDescriptionImplTest.TestTypeSystem");
      String workingDir = JUnitExtension.getFile("TypeSystemDescriptionImplTest").getParentFile()
          .getAbsolutePath();
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      resMgr.setDataPath(workingDir);
      absUrl = importObj.findAbsoluteUrl(resMgr);
      expectedUrl = new File(workingDir, "TypeSystemDescriptionImplTest/TestTypeSystem.xml")
      .toURL();
      assertEquals(expectedUrl, absUrl);
View Full Code Here

   
    //test aggregate with import by name and configuration parameter overrides
    in = new XMLInputSource(JUnitExtension
            .getFile("TextAnalysisEngineImplTest/AeWithConfigParamOverridesAndImportByName.xml"));
    desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in);
    ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
    File dataPathDir = JUnitExtension.getFile("TextAnalysisEngineImplTest/dataPathDir");
    resMgr.setDataPath(dataPathDir.getCanonicalPath());
    desc.doFullValidation(resMgr);
   
    //test UIMA C++ descriptor (should succeed even though annotator library doesn't exist)
    in = new XMLInputSource(JUnitExtension
            .getFile("TextAnalysisEngineImplTest/TestUimaCppAe.xml"));
View Full Code Here

  public void testValidate() throws Exception {
    //test aggregate with import by name and configuration parameter overrides
    XMLInputSource in = new XMLInputSource(JUnitExtension
            .getFile("TextAnalysisEngineImplTest/AeWithConfigParamOverridesAndImportByName.xml"));
    AnalysisEngineDescription desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in);
    ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
    File dataPathDir = JUnitExtension.getFile("TextAnalysisEngineImplTest/dataPathDir");
    resMgr.setDataPath(dataPathDir.getCanonicalPath());
    desc.validate(resMgr);
   
    //test invalid aggregate with undefined key in flow
    in = new XMLInputSource(JUnitExtension
            .getFile("TextAnalysisEngineImplTest/InvalidAggregate_UndefinedKeyInFlow.xml"));
View Full Code Here

      assertNotNull(ex);
      assertEquals(1, pri.getPriorityLists().length); // should be no side effects when exception is
      // thrown

      // set data path correctly and it should work
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      resMgr.setDataPath(JUnitExtension.getFile("TypePrioritiesImplTest/dataPathDir")
              .getAbsolutePath());
      pri.resolveImports(resMgr);

      priLists = pri.getPriorityLists();
      assertEquals(3, priLists.length);
View Full Code Here

    File datapath = new File(this.tempInstallDir, "uima.example.DateTimeAnnotator/my/test/data/path");
    File pearDatapath = new File(instPear.getComponentDataPath());
    Assert.assertEquals(datapath, pearDatapath);
       
    // Create resouce manager and set PEAR package classpath
    ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();

    // Create analysis engine from the installed PEAR package
    XMLInputSource in = new XMLInputSource(instPear.getComponentPearDescPath());
    ResourceSpecifier specifier = UIMAFramework.getXMLParser()
          .parseResourceSpecifier(in);
View Full Code Here

    if (fileName.charAt(0) == '.')
      fileName = fileName.substring(1);
    int partStart = 0;

    Import imp = UIMAFramework.getResourceSpecifierFactory().createImport();
    ResourceManager rm = editor.createResourceManager();

    for (;;) {
      imp.setName(fileName.substring(partStart));
      try {
        imp.findAbsoluteUrl(rm);
View Full Code Here

    if (aSpecifier instanceof CustomResourceSpecifier) {
      String className = ((CustomResourceSpecifier)aSpecifier).getResourceClassName();
      //check additional params map for ResourceManager, and use the UIMA extension ClassLoader
      //if one exists
      ClassLoader loader = null;
      ResourceManager resMgr = null;
      if (aAdditionalParams != null) {
        resMgr = (ResourceManager)aAdditionalParams.get(Resource.PARAM_RESOURCE_MANAGER);
      }
      if (resMgr != null) {
        loader = resMgr.getExtensionClassLoader();
      }
      if (loader == null) {
        loader = this.getClass().getClassLoader();
      }
     
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.ResourceManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.