Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceManager


   private synchronized ResourceManager createRM(StringPair sp, PackageBrowser pkgBrowser, ResourceManager parentResourceManager)
         throws MalformedURLException {
      // create UIMA resource manager and apply pear settings
//      ResourceManager rsrcMgr = UIMAFramework.newDefaultResourceManager();
     ResourceManager rsrcMgr;
     if (null == parentResourceManager) {
       // could be null for top level Pear not in an aggregate
       rsrcMgr = UIMAFramework.newDefaultResourceManager();
     } else {
       rsrcMgr = UIMAFramework.newDefaultResourceManagerPearWrapper();
       ((ResourceManagerPearWrapper)rsrcMgr).initializeFromParentResourceManager(parentResourceManager);
     }
     rsrcMgr.setExtensionClassPath(sp.classPath, true);
     UIMAFramework.getLogger(this.getClass()).logrb(
            Level.CONFIG,
            this.getClass().getName(),
            "createRM",
            LOG_RESOURCE_BUNDLE,
            "UIMA_pear_runtime_set_classpath__CONFIG",
            new Object[] { sp.classPath,
                  pkgBrowser.getRootDirectory().getName() });

      // get and set uima.datapath if specified
      if (sp.dataPath != null) {
         rsrcMgr.setDataPath(sp.dataPath);
         UIMAFramework.getLogger(this.getClass()).logrb(
               Level.CONFIG,
               this.getClass().getName(),
               "createRM",
               LOG_RESOURCE_BUNDLE,
View Full Code Here


      CasInitializerDescription desc = (CasInitializerDescription) aSpecifier;
      String className = desc.getImplementationName();

      // load class using UIMA Extension ClassLoader if there is one
      ClassLoader cl = null;
      ResourceManager resourceManager = null;
      if (aAdditionalParams != null) {
        resourceManager = (ResourceManager) aAdditionalParams.get(Resource.PARAM_RESOURCE_MANAGER);
      }
      if (resourceManager != null) {
        cl = resourceManager.getExtensionClassLoader();
      }
      if (cl == null) {
        cl = this.getClass().getClassLoader();
      }
View Full Code Here

      // Caller's Resource Manager obtained from the additional parameters
      // Note: UimaContext can be null for a top level call to
      // produceAnalysisEngine,
      // where the descriptor is a Pear Resource.

      ResourceManager applicationRM = (aAdditionalParams == null) ? null
          : (ResourceManager) aAdditionalParams.get(Resource.PARAM_RESOURCE_MANAGER);
      if (null == applicationRM) {
        UimaContextAdmin uimaContext = (aAdditionalParams == null) ? null
            : (UimaContextAdmin) aAdditionalParams.get(Resource.PARAM_UIMA_CONTEXT);
        if (null != uimaContext) {
          applicationRM = uimaContext.getResourceManager();
        }
      }

      String classPath = pkgBrowser.buildComponentRuntimeClassPath();
      String dataPath = pkgBrowser.getComponentDataPath();
      StringPair sp = new StringPair(classPath, dataPath);
      ResourceManager innerRM;

      synchronized (cachedResourceManagers) {
        Map<StringPair, ResourceManager> c1 = cachedResourceManagers.get(applicationRM);
        if (null == c1) {
          innerRM = createRM(sp, pkgBrowser, applicationRM);
View Full Code Here

                new Object[] {aSpecifier.getSourceUrlString()});
      }

      // load class using UIMA Extension ClassLoader if there is one
      ClassLoader cl = null;
      ResourceManager resourceManager = null;
      if (aAdditionalParams != null) {
        resourceManager = (ResourceManager) aAdditionalParams.get(Resource.PARAM_RESOURCE_MANAGER);
      }
      if (resourceManager != null) {
        cl = resourceManager.getExtensionClassLoader();
      }
      if (cl == null) {
        cl = this.getClass().getClassLoader();
      }
View Full Code Here

        }

        // load class using UIMA Extension ClassLoader if there is one
        ClassLoader cl = null;
        Class<?> implClass = null;
        ResourceManager resourceManager = null;
        if (aAdditionalParams != null) {
          resourceManager = (ResourceManager) aAdditionalParams
                  .get(Resource.PARAM_RESOURCE_MANAGER);
        }
        if (resourceManager != null) {
          cl = resourceManager.getExtensionClassLoader();
        }
        if (cl == null) {
          cl = this.getClass().getClassLoader();
        }
        try {
View Full Code Here

   * Gets the extension ClassLoader to used to locate the message digests. If this returns null,
   * then message digests will be searched for using this.class.getClassLoader().
   */
  private ClassLoader getExtensionClassLoader() {
    if (context instanceof UimaContextAdmin) {
      ResourceManager resMgr = ((UimaContextAdmin) context).getResourceManager();
      if (resMgr != null) {
        return resMgr.getExtensionClassLoader();
      }
      else {
        return null;
      }
    }
View Full Code Here

          throws ResourceInitializationException {
    if (!(aContext instanceof UimaContextAdmin)) {
      return Collections.emptyList();
    }

    ResourceManager resMgr = ((UimaContextAdmin) aContext).getResourceManager();
    if (!(resMgr instanceof ResourceManager_impl)) {
      // Unfortunately there is not official way to access the list of resources. Thus we
      // have to rely on the UIMA implementation details and access the internal resource
      // map via reflection. If the resource manager is not derived from the default
      // UIMA resource manager, then we cannot really do anything here.
      throw new IllegalStateException("Unsupported resource manager implementation ["
              + resMgr.getClass() + "]");
    }

    Field resourceMapField = null;
    try {
      // Fetch the list of resources
View Full Code Here

        LogFactory.getLog(TypePrioritiesFactory.class).warn(
                "[" + location + "] is not a type priorities descriptor file. Ignoring.", e);
      }
    }

    ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
    TypePriorities aggTypePriorities = CasCreationUtils.mergeTypePriorities(typePrioritiesList,
            resMgr);

    return aggTypePriorities;
  }
View Full Code Here

        } catch (Exception e) {
          log.warn(new StringBuilder("could not get AE from default RM \n ").append(e.getMessage()).toString());
        }
        if (ae == null) {
          try {
            ResourceManager rm = UIMAFramework.newDefaultResourceManager();
            rm.setExtensionClassPath(new ClerezzaUIMAExtensionClassLoader(getClass().getClassLoader()), "*", true);
            ae = UIMAFramework.produceAnalysisEngine(desc, rm, null);
          } catch (Exception e) {
            log.warn(new StringBuilder("could not get AE from extended classpath RM \n ").append(e.getMessage()).toString());
          }
        }
View Full Code Here

      throw new ResourceInitializationException();
    }
    if (!anApplicationContext.containsKey(UimaAsynchronousEngine.Endpoint)) {
      throw new ResourceInitializationException();
    }
    ResourceManager rm = null;
    if (anApplicationContext.containsKey(Resource.PARAM_RESOURCE_MANAGER)) {
      rm = (ResourceManager) anApplicationContext.get(Resource.PARAM_RESOURCE_MANAGER);
    } else {
      rm = UIMAFramework.newDefaultResourceManager();
    }
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.