Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceManager


   * 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


   *
   * @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

        validDefinition = true;
      } else {
        // String className = ((CasConsumerDescription) resourceSpecifier).getImplementationName();
        // load class using UIMA Extension ClassLoader if there is one
        ClassLoader cl = null;
        ResourceManager rm = getResourceManager();
        if (rm != null) {
          cl = rm.getExtensionClassLoader();
        }
        if (cl == null) {
          cl = this.getClass().getClassLoader();
        }
        // Class currentClass = Class.forName(className, true, cl);
View Full Code Here

    String className = null;
    try {
      className = ((CasConsumerDescription) aSpecifier).getImplementationName();
      // load class using UIMA Extension ClassLoader if there is one
      ClassLoader cl = null;
      ResourceManager rm = getResourceManager();
      if (rm != null) {
        cl = rm.getExtensionClassLoader();
      }
      if (cl == null) {
        cl = this.getClass().getClassLoader();
      }
      Class currentClass = Class.forName(className, true, cl);
View Full Code Here

    String className = null;
    try {
      className = ((CasInitializerDescription) aSpecifier).getImplementationName();
      // load class using UIMA Extension ClassLoader if there is one
      ClassLoader cl = null;
      ResourceManager rm = getResourceManager();
      if (rm != null) {
        cl = rm.getExtensionClassLoader();
      }
      if (cl == null) {
        cl = this.getClass().getClassLoader();
      }
      Class currentClass = Class.forName(className, true, cl);
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

      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

   * Create multiple processors which have to process multiple documents
   *
   * @throws Exception
   */
  public void testCasPool() throws Exception {
    ResourceManager rm = UIMAFramework.newDefaultResourceManager();
   
    // check temporary working directory
    if (this.pearInstallDir == null)
      throw new FileNotFoundException("PEAR install directory not found");
   
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

   * Test a CPE descriptor using import by name and requiring data patht o be set
   */
  public void testImportsWithDataPath() throws Exception {
    CpeDescription cpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(
            new XMLInputSource(JUnitExtension.getFile("CollectionProcessingEngineImplTest/CpeImportDataPathTest.xml")));
    ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
    File dataPathDir = JUnitExtension.getFile("CollectionProcessingEngineImplTest/imports");
    resMgr.setDataPath(dataPathDir.getAbsolutePath());
    CollectionProcessingEngine cpe = UIMAFramework.produceCollectionProcessingEngine(cpeDesc, resMgr, null);

    TestStatusCallbackListener listener = new TestStatusCallbackListener();
    cpe.addStatusCallbackListener(listener);

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.