org.geotools.factory.GeoTools.addFactoryIteratorProvider()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(142)

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

GeoTools.addFactoryIteratorProvider介绍

[英]Adds an alternative way to search for factory implementations. FactoryRegistry has a default mechanism bundled in it, which uses the content of all META-INF/servicesdirectories found on the classpath. This addFactoryIteratorProvider method allows to specify additional discovery algorithms. It may be useful in the context of some frameworks that use the constructor injection pattern, like the Spring framework.
[中]添加搜索工厂实现的替代方法。FactoryRegistry中捆绑了一个默认机制,它使用类路径上找到的所有META-INF/ServicesDirectory的内容。此AddFactoryReteratorProvider方法允许指定其他发现算法。在某些使用构造函数注入模式的框架中,如Spring framework,它可能很有用。

代码示例

代码示例来源:origin: locationtech/geowave

/**
 * Public "no argument" constructor called by Factory Service Provider (SPI) entry listed in
 * META-INF/services/org.geotools.data.DataStoreFactorySPI
 */
public GeoWaveGTDataStoreFactory() {
 final Collection<StoreFactoryFamilySpi> dataStoreFactories =
   GeoWaveStoreFinder.getRegisteredStoreFactoryFamilies().values();
 if (dataStoreFactories.isEmpty()) {
  LOGGER.error("No GeoWave DataStore found!  Geotools datastore for GeoWave is unavailable");
  geowaveStoreFactoryFamily = null;
 } else {
  final Iterator<StoreFactoryFamilySpi> it = dataStoreFactories.iterator();
  geowaveStoreFactoryFamily = it.next();
  if (it.hasNext()) {
   GeoTools.addFactoryIteratorProvider(new GeoWaveGTDataStoreFactoryIteratorProvider());
  }
 }
}

代码示例来源:origin: org.geoserver.extension/wps-core

@Override
protected void setUp() throws Exception {
  factory = new BeanProcessFactory();
  // check SPI will see the factory if we register it using an iterator
  // provider
  GeoTools.addFactoryIteratorProvider(new FactoryIteratorProvider() {
    public <T> Iterator<T> iterator(Class<T> category) {
      if (ProcessFactory.class.isAssignableFrom(category)) {
        return (Iterator<T>) Collections.singletonList(factory)
            .iterator();
      } else {
        return null;
      }
    }
  });
}

代码示例来源:origin: bcdev/beam

private void registerGeotoolsServices() {
  final ServiceRegistry<MathTransformProvider> serviceRegistry = ServiceRegistryManager.getInstance().getServiceRegistry(MathTransformProvider.class);
  loadServices(serviceRegistry);
  geotoolsFactoryIteratorProvider = new GeotoolsFactoryIteratorProvider(serviceRegistry);
  GeoTools.addFactoryIteratorProvider(geotoolsFactoryIteratorProvider);
}

相关文章