Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceManager


  }

  public void testAggregateWithImports() throws Exception {
    try {
      String pathSep = System.getProperty("path.separator");
      ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
      resMgr.setDataPath(JUnitExtension.getFile("TypeSystemDescriptionImplTest/dataPathDir")
              .getAbsolutePath()
              + pathSep
              + JUnitExtension.getFile("TypePrioritiesImplTest/dataPathDir").getAbsolutePath()
              + pathSep
              + JUnitExtension.getFile("FsIndexCollectionImplTest/dataPathDir").getAbsolutePath());
View Full Code Here


              .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

                new Object[] { key + "=" + value, pkgBrowser.getRootDirectory().getName() });

      }

      // create UIMA resource manager and apply pear settings
      ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();
      String classpath = pkgBrowser.buildComponentClassPath();
      rsrcMgr.setExtensionClassPath(classpath, true);
      UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
              "initialize", LOG_RESOURCE_BUNDLE, "UIMA_pear_runtime_set_classpath__CONFIG",
              new Object[] { classpath, pkgBrowser.getRootDirectory().getName() });

      // get and set uima.datapath if specified
      String dataPath = pkgBrowser.getComponentDataPath();
      if (dataPath != null) {
        rsrcMgr.setDataPath(dataPath);
        UIMAFramework.getLogger(this.getClass()).logrb(Level.CONFIG, this.getClass().getName(),
                "initialize", LOG_RESOURCE_BUNDLE, "UIMA_pear_runtime_set_datapath__CONFIG",
                new Object[] { dataPath, pkgBrowser.getRootDirectory().getName() });
      }
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

   *
   * @return the text analysis engine
   * @throws ResourceInitializationException
   */
  public AnalysisEngine createAnnotator() throws ResourceInitializationException {
    ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();

    if (mResourceBasePath.getLocation() != null) {
      try {
        resourceManager.setDataPath(mResourceBasePath.getLocation().toOSString());
      } catch (MalformedURLException e) {
        // this will not happen
        throw new TaeError("Unexpexted exceptioon", e);
      }
    }
View Full Code Here

   * Creates the consumer.
   *
   * @return the consumer
   */
  public CasConsumer createConsumer() {
    ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();

    if (resourceBasePath.getLocation() != null) {
      try {
        resourceManager.setExtensionClassPath(resourceBasePath.getLocation().toOSString(), true);
        resourceManager.setDataPath(resourceBasePath.getLocation().toOSString());
      } catch (MalformedURLException e) {
        // this should never happen
        throw new TaeError("Unexpected exception", e);
      }
    }
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
   */
  public ResourceManager createResourceManager() {
    // long time = System.currentTimeMillis();
    ResourceManager rm = createResourceManager(null);
    // System.out.println("CreateResourceManager: " + (System.currentTimeMillis() - time));
    return rm;
  }
View Full Code Here

    return rm;
  }

  public ResourceManager createResourceManager(String classPath) {
    // workspacePath = TAEConfiguratorPlugin.getWorkspace().getRoot().getLocation().toString();
    ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();

    try {
      if (null == classPath)
        classPath = getProjectClassPath();
      resourceManager.setExtensionClassPath(this.getClass().getClassLoader(), classPath, true);
      resourceManager.setDataPath(CDEpropertyPage.getDataPath(getProject()));
    } catch (MalformedURLException e1) {
      throw new InternalErrorCDE(Messages.getString("MultiPageEditor.14"), e1); //$NON-NLS-1$
    } catch (CoreException e1) {
      throw new InternalErrorCDE(Messages.getString("MultiPageEditor.15"), e1); //$NON-NLS-1$
    }
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.