当前位置: 首页>>代码示例>>Java>>正文


Java ServiceRegistry.lookupProviders方法代码示例

本文整理汇总了Java中javax.imageio.spi.ServiceRegistry.lookupProviders方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceRegistry.lookupProviders方法的具体用法?Java ServiceRegistry.lookupProviders怎么用?Java ServiceRegistry.lookupProviders使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.imageio.spi.ServiceRegistry的用法示例。


在下文中一共展示了ServiceRegistry.lookupProviders方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public void load() {
    Iterator<JobValidatorService> loadedFactories = ServiceRegistry.lookupProviders(JobValidatorService.class);
    ImmutableMap.Builder<String, JobValidatorService> mapBuilder = new ImmutableMap.Builder();
    while (loadedFactories.hasNext()) {
        try {
            JobValidatorService validator = loadedFactories.next();
            String validatorID = validator.getClass().getCanonicalName();

            logger.debug("Job Validator Factory provider <" + validatorID + "> found");
            mapBuilder.put(validatorID, validator);
        } catch (Exception err) {
            logger.error("Failed to load job validator factory: " + err);
        }
    }
    jobValidators = mapBuilder.build();
    if (logger.isInfoEnabled()) {
        logger.info("[JobValidatorRegistry] job validators registered : " + jobValidators.keySet());
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling,代码行数:20,代码来源:JobValidatorRegistry.java

示例2: getLogicalTimeFactory

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
/**
 * Locates and constructs a LogicalTimeFactory matching the specified name.
 * Each federation chooses its implementation by passing the appropriate name
 * to createFederationExecution.
 * If the supplied name is the empty string, the HLAfloat64TimeFactory is
 * returned.  If the supplied implementation name does not match any name
 * supported by the library, then a NULL pointer is returned.
 *
 * @param name
 * @return
 */
public static LogicalTimeFactory getLogicalTimeFactory(String name)
{
   if (name.equals("")) {
      name = "HLAfloat64Time";
   }
   Iterator<LogicalTimeFactory> i = ServiceRegistry.lookupProviders(LogicalTimeFactory.class);
   while (i.hasNext()) {
      LogicalTimeFactory logicalTimeFactory = i.next();
      if (logicalTimeFactory.getName().equals(name)) {
         return logicalTimeFactory;
      }
   }
   return null;
}
 
开发者ID:MSG134,项目名称:IVCT_Framework,代码行数:26,代码来源:LogicalTimeFactoryFactory.java

示例3: getAvailableLogicalTimeFactories

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public static Set<LogicalTimeFactory> getAvailableLogicalTimeFactories()
{
   Iterator<LogicalTimeFactory> i = ServiceRegistry.lookupProviders(LogicalTimeFactory.class);
   Set<LogicalTimeFactory> factories = new HashSet<LogicalTimeFactory>();
   while (i.hasNext()) {
      LogicalTimeFactory logicalTimeFactory = i.next();
      factories.add(logicalTimeFactory);
   }
   return factories;
}
 
开发者ID:MSG134,项目名称:IVCT_Framework,代码行数:11,代码来源:LogicalTimeFactoryFactory.java

示例4: getRtiFactory

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public static RtiFactory getRtiFactory(String name)
   throws
   RTIinternalError
{
   Iterator<RtiFactory> i = ServiceRegistry.lookupProviders(RtiFactory.class);
   while (i.hasNext()) {
      RtiFactory rtiFactory = i.next();
      if (rtiFactory.rtiName().equals(name)) {
         return rtiFactory;
      }
   }
   throw new RTIinternalError("Cannot find factory matching " + name);
}
 
开发者ID:MSG134,项目名称:IVCT_Framework,代码行数:14,代码来源:RtiFactoryFactory.java

示例5: getAvailableRtiFactories

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public static Set<RtiFactory> getAvailableRtiFactories()
{
   Iterator<RtiFactory> i = ServiceRegistry.lookupProviders(RtiFactory.class);
   Set<RtiFactory> factories = new HashSet<RtiFactory>();
   while (i.hasNext()) {
      RtiFactory rtiFactory = i.next();
      factories.add(rtiFactory);
   }
   return factories;
}
 
开发者ID:MSG134,项目名称:IVCT_Framework,代码行数:11,代码来源:RtiFactoryFactory.java

示例6: newFactory

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
@Override
protected GeneralDBConnectionFactory newFactory(DatabaseMetaData metaData) throws SQLException {
  String dbn = metaData.getDatabaseProductName();
  String dbv = metaData.getDatabaseProductVersion();
  GeneralDBConnectionFactory factory;
  Iterator<GeneralDBProvider> providers;
  providers = ServiceRegistry.lookupProviders(GeneralDBProvider.class);
  while (providers.hasNext()) {
    GeneralDBProvider provider = providers.next();
    factory = provider.createRdbmsConnectionFactory(dbn, dbv);
    if (factory != null)
      return factory;
  }
  return new PostGISConnectionFactory();
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:16,代码来源:PostGISStore.java

示例7: newFactory

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
@Override
protected GeneralDBConnectionFactory newFactory(DatabaseMetaData metaData) throws SQLException {
  String dbn = metaData.getDatabaseProductName();
  String dbv = metaData.getDatabaseProductVersion();
  GeneralDBConnectionFactory factory;
  Iterator<MonetDBProvider> providers;
  providers = ServiceRegistry.lookupProviders(MonetDBProvider.class);
  while (providers.hasNext()) {
    MonetDBProvider provider = providers.next();
    factory = provider.createRdbmsConnectionFactory(dbn, dbv);
    if (factory != null)
      return factory;
  }
  return new MonetDBConnectionFactory();
}
 
开发者ID:esarbanis,项目名称:strabon,代码行数:16,代码来源:MonetDBStore.java

示例8: load

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public <T> Iterator<T> load(
		final Class<T> service ) {

	final Set<ClassLoader> checkset = new HashSet<ClassLoader>();
	final Set<ClassLoader> clSet = getClassLoaders();
	final Iterator<ClassLoader> loaderIt = clSet.iterator();

	return new Iterator<T>() {

		Iterator<T> spiIT = null;

		@Override
		public boolean hasNext() {
			while ((spiIT == null || !spiIT.hasNext()) && (loaderIt.hasNext())) {
				final ClassLoader l = loaderIt.next();
				if (checkset.contains(l)) continue;
				checkset.add(l);
				spiIT = (Iterator<T>) ServiceRegistry.lookupProviders(
						service,
						l);
			}
			return spiIT != null && spiIT.hasNext();
		}

		@Override
		public T next() {
			return (T) spiIT.next();
		}

		@Override
		public void remove() {}

	};
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:35,代码来源:SPIServiceRegistry.java

示例9: testGuiceWorksInOSGiContainer

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public void testGuiceWorksInOSGiContainer()
      throws Throwable {

    // ask framework to clear cache on startup
    Properties properties = new Properties();
    properties.setProperty("org.osgi.framework.storage", BUILD_TEST_DIR + "/bundle.cache");
    properties.setProperty("org.osgi.framework.storage.clean", "onFirstInit");

    // test each available OSGi framework in turn
    Iterator<FrameworkFactory> f = ServiceRegistry.lookupProviders(FrameworkFactory.class);
    while (f.hasNext()) {
      Framework framework = f.next().newFramework(properties);

      framework.start();
      BundleContext systemContext = framework.getBundleContext();

      // load all the necessary bundles and start the OSGi test bundle
/*if[AOP]*/
      systemContext.installBundle("reference:file:" + BUILD_TEST_DIR + "/aopalliance.jar");
/*end[AOP]*/
      systemContext.installBundle("reference:file:" + BUILD_TEST_DIR + "/javax.inject.jar");
      systemContext.installBundle("reference:file:" + BUILD_TEST_DIR + "/guava.jar");
      systemContext.installBundle("reference:file:" + GUICE_JAR);
      systemContext.installBundle("reference:file:" + BUILD_TEST_DIR + "/osgitests.jar").start();

      framework.stop();
    }
  }
 
开发者ID:cgruber,项目名称:guice-old,代码行数:29,代码来源:OSGiContainerTest.java

示例10: writeImage

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
@Override
public void writeImage(final OutputStream out, final BufferedImage img,
	final JPEG2000CodecOptions options) throws IOException, ServiceException
{
	final ImageOutputStream ios = ImageIO.createImageOutputStream(out);

	final IIORegistry registry = IIORegistry.getDefaultInstance();
	final Iterator<J2KImageWriterSpi> iter =
		ServiceRegistry.lookupProviders(J2KImageWriterSpi.class);
	registry.registerServiceProviders(iter);
	final J2KImageWriterSpi spi =
		registry.getServiceProviderByClass(J2KImageWriterSpi.class);
	final J2KImageWriter writer = new J2KImageWriter(spi);
	writer.setOutput(ios);

	final String filter =
		options.lossless ? J2KImageWriteParam.FILTER_53
			: J2KImageWriteParam.FILTER_97;

	final IIOImage iioImage = new IIOImage(img, null, null);
	final J2KImageWriteParam param =
		(J2KImageWriteParam) writer.getDefaultWriteParam();
	param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
	param.setCompressionType("JPEG2000");
	param.setLossless(options.lossless);
	param.setFilter(filter);
	param.setCodeBlockSize(options.codeBlockSize);
	param.setEncodingRate(options.quality);
	if (options.tileWidth > 0 && options.tileHeight > 0) {
		param.setTiling(options.tileWidth, options.tileHeight,
			options.tileGridXOffset, options.tileGridYOffset);
	}
	if (options.numDecompositionLevels != null) {
		param
			.setNumDecompositionLevels(options.numDecompositionLevels.intValue());
	}
	writer.write(null, iioImage, param);
	ios.close();
}
 
开发者ID:scifio,项目名称:scifio,代码行数:40,代码来源:JAIIIOServiceImpl.java

示例11: getReader

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
/** Set up the JPEG-2000 image reader. */
private J2KImageReader getReader() {
	final IIORegistry registry = IIORegistry.getDefaultInstance();
	final Iterator<J2KImageReaderSpi> iter =
		ServiceRegistry.lookupProviders(J2KImageReaderSpi.class);
	registry.registerServiceProviders(iter);
	final J2KImageReaderSpi spi =
		registry.getServiceProviderByClass(J2KImageReaderSpi.class);
	return new J2KImageReader(spi);
}
 
开发者ID:scifio,项目名称:scifio,代码行数:11,代码来源:JAIIIOServiceImpl.java

示例12: testGuiceWorksInOSGiContainer

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public void testGuiceWorksInOSGiContainer()
      throws Throwable {

    // ask framework to clear cache on startup
    Properties properties = new Properties();
    properties.setProperty("org.osgi.framework.storage", BUILD_TEST_DIR + "/bundle.cache");
    properties.setProperty("org.osgi.framework.storage.clean", "onFirstInit");

    // test each available OSGi framework in turn
    Iterator<FrameworkFactory> f = ServiceRegistry.lookupProviders(FrameworkFactory.class);
    while (f.hasNext()) {
      Framework framework = f.next().newFramework(properties);

      framework.start();
      BundleContext systemContext = framework.getBundleContext();

      // load all the necessary bundles and start the OSGi test bundle
/*if[AOP]*/
      systemContext.installBundle("reference:file:" + BUILD_TEST_DIR + "/aopalliance.jar");
/*end[AOP]*/
      systemContext.installBundle("reference:file:" + BUILD_TEST_DIR + "/javax.inject.jar");
      systemContext.installBundle("reference:file:" + GUICE_JAR);
      systemContext.installBundle("reference:file:" + BUILD_TEST_DIR + "/osgitests.jar").start();

      framework.stop();
    }
  }
 
开发者ID:utopiazh,项目名称:google-guice,代码行数:28,代码来源:OSGiContainerTest.java

示例13: get

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
/**
 * aliases for the Socket Factories provided with ProActive
 */
public static PAMRSocketFactorySPI get() {

    if (!PAMRConfig.PA_PAMR_SOCKET_FACTORY.isSet()) {
        // the user wants the default
        return getDefaultSocketFactory();
    }

    String socketFactory = PAMRConfig.PA_PAMR_SOCKET_FACTORY.getValue();

    Iterator<PAMRSocketFactorySPI> socketFactories = ServiceRegistry
            .lookupProviders(PAMRSocketFactorySPI.class);
    try {
        while (socketFactories.hasNext()) {
            PAMRSocketFactorySPI factory = socketFactories.next();
            if (socketFactory.equals(factory.getAlias()) ||
                socketFactories.equals(factory.getClass().getName())) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Installing the " + factory.getAlias() + " (" +
                        factory.getClass().getName() + ") socket factory for message routing");
                }
                return factory;
            }
        }
    } catch (Error e) {
        logger.warn("Failed to load a service provider for " + PAMRSocketFactorySPI.class.getName(), e);
    }

    logger
            .warn(socketFactory +
                " is neither an alias for a socket factory provided with ProActive,\n" +
                "   nor a class name for a socket factory which could be found using the service provider mechanisms.\n" +
                "   Will instantiate the default, plain socket factory.");

    return getDefaultSocketFactory();
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:39,代码来源:PAMRSocketFactorySelector.java

示例14: lookup

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
public static <T extends ServiceProvider> Iterator<T> lookup(Class<T> clazz) {
		ClassLoader cl = ClassLoader.getSystemClassLoader();
//      return java.util.ServiceLoader.load(clazz, cl).iterator(); // jse 6
///		return (Iterator<T>)sun.misc.Service.providers(clazz, cl); // jse 5 sun
		return ServiceRegistry.lookupProviders(clazz, cl); // jse version compatibility hack !!!
    }
 
开发者ID:petersalomonsen,项目名称:frinika,代码行数:7,代码来源:Services.java

示例15: createInstance

import javax.imageio.spi.ServiceRegistry; //导入方法依赖的package包/类
/**
 * @param fileName
 *            name of the configuration file
 * @return configuration factory which is able to process specified
 *         configuration file or <code>null</code> otherwise.
 * @throws IllegalArgumentException
 *             if <code>fileName</code> is illegal
 * @see #ILLEGAL_FILE_NAMES
 */
public static final AbstractConfigurationFactory createInstance(final String fileName) {

    if (ILLEGAL_FILE_NAMES.contains(fileName)) {

        throw new IllegalArgumentException(fileName);
    }

    Iterator<AbstractConfigurationFactory> providers = ServiceRegistry.lookupProviders(AbstractConfigurationFactory.class);

    while (providers.hasNext()) {

        AbstractConfigurationFactory configurationFactory = providers.next();

        if (configurationFactory.acceptsFileType(getFileExtension(fileName))) {

            try {

                // we need a configuration created using constructor with file name
                final Constructor<?extends AbstractConfigurationFactory> constructor = configurationFactory.getClass().getConstructor(String.class);

                return constructor.newInstance(fileName);
            } catch (Exception e) {

                // just wrap a bunch of different exceptions into a single
                throw new ArchitectureException(e);
            }
        }
    }

    return null;
}
 
开发者ID:AndyScherzinger,项目名称:architecturerules,代码行数:41,代码来源:DefaultConfigurationFactory.java


注:本文中的javax.imageio.spi.ServiceRegistry.lookupProviders方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。