Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceManager


              .getFile("CasCreationUtilsTest/TaeWithImports.xml");
      AnalysisEngineDescription desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(
              new XMLInputSource(taeDescriptorWithImport));

      // create Resource Manager & set data path - necessary to resolve imports
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      String pathSep = System.getProperty("path.separator");
      resMgr.setDataPath(JUnitExtension.getFile("TypeSystemDescriptionImplTest/dataPathDir")
              .getAbsolutePath()
              + pathSep
              + JUnitExtension.getFile("TypePrioritiesImplTest/dataPathDir").getAbsolutePath()
              + pathSep
              + JUnitExtension.getFile("FsIndexCollectionImplTest/dataPathDir").getAbsolutePath());
View Full Code Here


              || label2.equals("FlowControllerTestIndex"));

      // Now test case where aggregate contains a remote, and we want to do the
      // merge of the non-remote delegates and report the failure.  (This example
      // also happens to use import-by-name so we need to set the data path.)
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      String pathSep = System.getProperty("path.separator");
      resMgr.setDataPath(JUnitExtension.getFile("TypeSystemDescriptionImplTest/dataPathDir")
              .getAbsolutePath()
              + pathSep
              + JUnitExtension.getFile("TypePrioritiesImplTest/dataPathDir").getAbsolutePath()
              + pathSep
              + JUnitExtension.getFile("FsIndexCollectionImplTest/dataPathDir").getAbsolutePath());
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

      AnalysisEngineDescription aggregateSegDesc = UIMAFramework.getXMLParser()
              .parseAnalysisEngineDescription(
                      new XMLInputSource(JUnitExtension
                              .getFile("TextAnalysisEngineImplTest/AggregateWithSegmenter.xml")));
     
      ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();
      Map<String, Object> params = new HashMap<String, Object>();
      AnalysisEngine ae1 = UIMAFramework.produceAnalysisEngine(aggregateSegDesc, rsrcMgr, params);
      AnalysisEngine ae2 = UIMAFramework.produceAnalysisEngine(aggregateSegDesc, rsrcMgr, params);
     
      // start with testing first ae
View Full Code Here

      return "";
    return s;
  }

  public ResourceManager createResourceManager() {
    ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();

    try {
      resourceManager.setExtensionClassPath(this.getClass().getClassLoader(), classPath, true);
    } catch (MalformedURLException e1) {
      error.newError(IError.ERROR, getString("Internal Error", null), e1);
    }
    return resourceManager;
  }
View Full Code Here

    }
  }

  protected boolean setupAE(File aeFile) {
    try {
      ResourceManager rsrcMgr = null;
      if (this.dataPathName != null) {
        try {
          rsrcMgr = UIMAFramework.newDefaultResourceManager();
          rsrcMgr.setDataPath(this.dataPathName);
        } catch (MalformedURLException e) {
          StringBuffer msg = new StringBuffer();
          msg.append("Error setting data path in AE,\n");
          msg.append("data path contains invalid URL or file descriptor.\n");
          msg.append("You can still run the AE if it doesn't rely on the data path.\n");
View Full Code Here

    }
    script += rules;
    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);
View Full Code Here

    }
    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;

    ae = UIMAFramework.produceAnalysisEngine(aed, resMgr, null);
    File tempFile = File.createTempFile("RutaCDE", RutaEngine.SCRIPT_FILE_EXTENSION);
    tempFile.deleteOnExit();
View Full Code Here

      CAS cas = null;
      AnalysisEngine ae = null;
      try {
        XMLInputSource in = new XMLInputSource(descriptorPath.toPortableString());
        ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
        ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
        resMgr.setDataPath(rootPath.toPortableString());
        ae = UIMAFramework.produceAnalysisEngine(specifier, resMgr, null);
        initAE(ae);
        ae.reconfigure();
      } catch (Exception e) {
        DLTKCore.error(e.getMessage(), e);
View Full Code Here

    }
    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);
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.