org.apache.uima.resource.ResourceManager.initializeExternalResources()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.apache.uima.resource.ResourceManager.initializeExternalResources方法的一些代码示例,展示了ResourceManager.initializeExternalResources的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceManager.initializeExternalResources方法的具体详情如下:
包路径:org.apache.uima.resource.ResourceManager
类名称:ResourceManager
方法名:initializeExternalResources

ResourceManager.initializeExternalResources介绍

[英]Initializes all external resources declared in a ResourceCreationSpecifier. Multi-threading: may be called on multiple threads. Initialization should be done once, on the first call External resources have a Container class representing the resource, which are instances of Resource. This may act as the implementation class, or they may also have a separately specified implementation class, which may or may not implement Resource. As part of the initialization of the Container class, by default, External Resource Bindings are processed to hook them up with defined External Resources, using the default implementation of resolveAndValidateResourceDependencies.
[中]初始化ResourceCreationSpecifier中声明的所有外部资源。多线程:可以在多个线程上调用。初始化应该完成一次,在第一次调用时,外部资源有一个表示资源的容器类,它是资源的实例。这可以充当实现类,也可以有单独指定的实现类,该类可以实现资源,也可以不实现资源。作为容器类初始化的一部分,默认情况下,使用resolveAndValidateResourceDependencies的默认实现,处理外部资源绑定以将它们与定义的外部资源连接起来。

代码示例

代码示例来源:origin: org.apache.uima/uimaj-cpe

resMgrCfg = UIMAFramework.getXMLParser().parseResourceManagerConfiguration(
    new XMLInputSource(descriptorPath));
aResourceManager.initializeExternalResources(resMgrCfg, "/", null);

代码示例来源:origin: dkpro/dkpro-tc

@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(TcFeature feature)
  throws ResourceInitializationException, ResourceAccessException
{
  // Configure external resource
  ExternalResourceDescription desc = feature.getActualValue();
  // Configure resource manager
  ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
      .createResourceManagerConfiguration();
  ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
  // Instantiate resource manager (internally instantiates resources)
  final ResourceManager manager = new ResourceManager_impl();
  manager.initializeExternalResources(cfg, "/", null);
  T res = (T) manager.getResource("/rootResource");
  // Initialize nested resources
  UimaContextAdmin ctx = new RootUimaContext_impl()
  {
    @Override
    public ResourceManager getResourceManager()
    {
      return manager;
    };
  };
  ExternalResourceInitializer.initialize(res, ctx);
  // Get resource instance
  return res;
}

代码示例来源:origin: org.dkpro.tc/dkpro-tc-api-features

@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(TcFeature feature)
  throws ResourceInitializationException, ResourceAccessException
{
  // Configure external resource
  ExternalResourceDescription desc = feature.getActualValue();
  // Configure resource manager
  ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
      .createResourceManagerConfiguration();
  ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
  // Instantiate resource manager (internally instantiates resources)
  final ResourceManager manager = new ResourceManager_impl();
  manager.initializeExternalResources(cfg, "/", null);
  T res = (T) manager.getResource("/rootResource");
  // Initialize nested resources
  UimaContextAdmin ctx = new RootUimaContext_impl()
  {
    @Override
    public ResourceManager getResourceManager()
    {
      return manager;
    };
  };
  ExternalResourceInitializer.initialize(res, ctx);
  // Get resource instance
  return res;
}

代码示例来源:origin: org.dkpro.tc/dkpro-tc-api-features

@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(Class<T> aClass, Object... aParam)
  throws ResourceInitializationException, ResourceAccessException
{
  // Configure external resource
  ExternalResourceDescription desc = ExternalResourceFactory
      .createExternalResourceDescription(aClass, aParam);
  // Configure resource manager
  ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
      .createResourceManagerConfiguration();
  ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
  // Instantiate resource manager (internally instantiates resources)
  final ResourceManager manager = new ResourceManager_impl();
  manager.initializeExternalResources(cfg, "/", null);
  T res = (T) manager.getResource("/rootResource");
  // Initialize nested resources
  UimaContextAdmin ctx = new RootUimaContext_impl()
  {
    @Override
    public ResourceManager getResourceManager()
    {
      return manager;
    };
  };
  ExternalResourceInitializer.initialize(res, ctx);
  // Get resource instance
  return res;
}

代码示例来源:origin: dkpro/dkpro-tc

@SuppressWarnings("unchecked")
public static <T extends Resource> T createResource(Class<T> aClass, Object... aParam)
  throws ResourceInitializationException, ResourceAccessException
{
  // Configure external resource
  ExternalResourceDescription desc = ExternalResourceFactory
      .createExternalResourceDescription(aClass, aParam);
  // Configure resource manager
  ResourceManagerConfiguration cfg = UIMAFramework.getResourceSpecifierFactory()
      .createResourceManagerConfiguration();
  ExternalResourceFactory.bindExternalResource(cfg, "rootResource", desc);
  // Instantiate resource manager (internally instantiates resources)
  final ResourceManager manager = new ResourceManager_impl();
  manager.initializeExternalResources(cfg, "/", null);
  T res = (T) manager.getResource("/rootResource");
  // Initialize nested resources
  UimaContextAdmin ctx = new RootUimaContext_impl()
  {
    @Override
    public ResourceManager getResourceManager()
    {
      return manager;
    };
  };
  ExternalResourceInitializer.initialize(res, ctx);
  // Get resource instance
  return res;
}

代码示例来源:origin: apache/uima-uimaj

mUimaContextAdmin.getResourceManager().initializeExternalResources(resMgrCfg,
     mUimaContextAdmin.getQualifiedContextName(), aAdditionalParmsForExtResources);
} finally {

相关文章