javax.imageio.spi.ServiceRegistry Java Examples

The following examples show how to use javax.imageio.spi.ServiceRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImageIO.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #2
Source File: ImageIO.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #3
Source File: ImageIO.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #4
Source File: ImageIO.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #5
Source File: JobValidatorRegistry.java    From scheduling with GNU Affero General Public License v3.0 6 votes vote down vote up
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());
    }
}
 
Example #6
Source File: ImageIO.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an {@code Iterator} containing all currently
 * registered {@code ImageTranscoder}s that claim to be
 * able to transcode between the metadata of the given
 * {@code ImageReader} and {@code ImageWriter}.
 *
 * @param reader an {@code ImageReader}.
 * @param writer an {@code ImageWriter}.
 *
 * @return an {@code Iterator} containing
 * {@code ImageTranscoder}s.
 *
 * @exception IllegalArgumentException if {@code reader} or
 * {@code writer} is {@code null}.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator<ImageTranscoderSpi> iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #7
Source File: ImageIO.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #8
Source File: ImageIO.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #9
Source File: J2KImageWriterSpi.java    From healthcare-dicom-dicomweb-adapter with Apache License 2.0 6 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class category) {
    if (registered) {
        return;
    }
	
    registered = true;

    // Set pairwise ordering to give codecLib writer precedence.
    Class codecLibWriterSPIClass = null;
    try {
        codecLibWriterSPIClass =
            Class.forName("com.github.jaiimageio.jpeg2000.impl.J2KImageWriterCodecLibSpi");
    } catch(Throwable t) {
        // Ignore it.
    }

    if(codecLibWriterSPIClass != null) {
        Object codecLibWriterSPI =
            registry.getServiceProviderByClass(codecLibWriterSPIClass);
        if(codecLibWriterSPI != null) {
            registry.setOrdering(category, codecLibWriterSPI, this);
        }
    }
}
 
Example #10
Source File: J2KImageReaderSpi.java    From healthcare-dicom-dicomweb-adapter with Apache License 2.0 6 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class category) {
    if (registered) {
        return;
    }
	
    registered = true;

    // Set pairwise ordering to give codecLib reader precedence.
    Class codecLibReaderSPIClass = null;
    try {
        codecLibReaderSPIClass =
            Class.forName("com.github.jaiimageio.jpeg2000.impl.J2KImageReaderCodecLibSpi");
    } catch(Throwable t) {
        // Ignore it.
    }

    if(codecLibReaderSPIClass != null) {
        Object codecLibReaderSPI =
            registry.getServiceProviderByClass(codecLibReaderSPIClass);
        if(codecLibReaderSPI != null) {
            registry.setOrdering(category, codecLibReaderSPI, this);
        }
    }
}
 
Example #11
Source File: ImageIO.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #12
Source File: SpiTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public SpiTest() {
    testImageReaderSpiConstructor();
    testImageWriterSpiConstructor();

    ServiceRegistry registry = IIORegistry.getDefaultInstance();
    Iterator readers = registry.getServiceProviders(ImageReaderSpi.class,
                                                    false);
    while (readers.hasNext()) {
        ImageReaderSpi rspi = (ImageReaderSpi)readers.next();
        System.out.println("*** Testing " + rspi.getClass().getName());
        testSpi(rspi);
    }

    Iterator writers = registry.getServiceProviders(ImageWriterSpi.class,
                                                    false);
    while (writers.hasNext()) {
        ImageWriterSpi wspi = (ImageWriterSpi)writers.next();
        System.out.println("*** Testing " + wspi.getClass().getName());
        testSpi(wspi);
    }
}
 
Example #13
Source File: DeregisterOrderedSpiTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public DeregisterOrderedSpiTest() {

         try {

             ServiceRegistry reg = IIORegistry.getDefaultInstance();
             ImageReaderSpi gifSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.gif.GIFImageReaderSpi.class);
             ImageReaderSpi pngSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.png.PNGImageReaderSpi.class);
             ImageReaderSpi jpgSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.class);
             ImageReaderSpi bmpSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.bmp.BMPImageReaderSpi.class);

             boolean ordered = reg.setOrdering(ImageReaderSpi.class, pngSpi,
                                               gifSpi);

             ordered = reg.setOrdering(ImageReaderSpi.class, gifSpi, jpgSpi);
             ordered = reg.setOrdering(ImageReaderSpi.class, bmpSpi, gifSpi);
             reg.deregisterServiceProvider(gifSpi);
             System.out.println("PASS");

         } catch (Exception e) {
             System.out.println("FAIL");
             throw new RuntimeException("Deregistering a spi object involved in some "
                                        + "ordering throws the following exception: " + e.toString());
         }
     }
 
Example #14
Source File: ImageIOGreyScale.java    From multimedia-indexing with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently registered <code>ImageTranscoder</code>s that
 * claim to be able to transcode between the metadata of the given <code>ImageReader</code> and
 * <code>ImageWriter</code>.
 * 
 * @param reader
 *            an <code>ImageReader</code>.
 * @param writer
 *            an <code>ImageWriter</code>.
 * 
 * @return an <code>Iterator</code> containing <code>ImageTranscoder</code>s.
 * 
 * @exception IllegalArgumentException
 *                if <code>reader</code> or <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer) {
	if (reader == null) {
		throw new IllegalArgumentException("reader == null!");
	}
	if (writer == null) {
		throw new IllegalArgumentException("writer == null!");
	}
	ImageReaderSpi readerSpi = reader.getOriginatingProvider();
	ImageWriterSpi writerSpi = writer.getOriginatingProvider();
	ServiceRegistry.Filter filter = new TranscoderFilter(readerSpi, writerSpi);

	Iterator iter;
	// Ensure category is present
	try {
		iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class, filter, true);
	} catch (IllegalArgumentException e) {
		return new HashSet().iterator();
	}
	return new ImageTranscoderIterator(iter);
}
 
Example #15
Source File: OrderingTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public OrderingTest() {

         ServiceRegistry reg = IIORegistry.getDefaultInstance();
         ImageReaderSpi gifSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.gif.GIFImageReaderSpi.class);
         ImageReaderSpi pngSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.png.PNGImageReaderSpi.class);

         boolean ordered = reg.setOrdering(ImageReaderSpi.class, gifSpi, pngSpi);

         ordered = reg.setOrdering(ImageReaderSpi.class, pngSpi, gifSpi);

         boolean unordered = reg.unsetOrdering(ImageReaderSpi.class, gifSpi,
                                               pngSpi);
         boolean unordered1 = reg.unsetOrdering(ImageReaderSpi.class, gifSpi,
                                                pngSpi);

         if (unordered1) {
             throw new RuntimeException("FAIL: Ordering 2 spi objects in the  "
                                        + "reverse direction does not remove the previous ordering "
                                        + "set between the spi objects and hence unsetOrdering() "
                                        + "returns true for the same spi objects when called consecutively");
         } else {
             System.out.println("PASS");
         }

     }
 
Example #16
Source File: SpiTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public SpiTest() {
    testImageReaderSpiConstructor();
    testImageWriterSpiConstructor();

    ServiceRegistry registry = IIORegistry.getDefaultInstance();
    Iterator readers = registry.getServiceProviders(ImageReaderSpi.class,
                                                    false);
    while (readers.hasNext()) {
        ImageReaderSpi rspi = (ImageReaderSpi)readers.next();
        System.out.println("*** Testing " + rspi.getClass().getName());
        testSpi(rspi);
    }

    Iterator writers = registry.getServiceProviders(ImageWriterSpi.class,
                                                    false);
    while (writers.hasNext()) {
        ImageWriterSpi wspi = (ImageWriterSpi)writers.next();
        System.out.println("*** Testing " + wspi.getClass().getName());
        testSpi(wspi);
    }
}
 
Example #17
Source File: OrderingTest.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
public OrderingTest() {

         ServiceRegistry reg = IIORegistry.getDefaultInstance();
         ImageReaderSpi gifSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.gif.GIFImageReaderSpi.class);
         ImageReaderSpi pngSpi = (ImageReaderSpi) reg.getServiceProviderByClass(com.sun.imageio.plugins.png.PNGImageReaderSpi.class);

         boolean ordered = reg.setOrdering(ImageReaderSpi.class, gifSpi, pngSpi);

         ordered = reg.setOrdering(ImageReaderSpi.class, pngSpi, gifSpi);

         boolean unordered = reg.unsetOrdering(ImageReaderSpi.class, gifSpi,
                                               pngSpi);
         boolean unordered1 = reg.unsetOrdering(ImageReaderSpi.class, gifSpi,
                                                pngSpi);

         if (unordered1) {
             throw new RuntimeException("FAIL: Ordering 2 spi objects in the  "
                                        + "reverse direction does not remove the previous ordering "
                                        + "set between the spi objects and hence unsetOrdering() "
                                        + "returns true for the same spi objects when called consecutively");
         } else {
             System.out.println("PASS");
         }

     }
 
Example #18
Source File: ImageIO.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Returns an <code>Iterator</code> containing all currently
 * registered <code>ImageTranscoder</code>s that claim to be
 * able to transcode between the metadata of the given
 * <code>ImageReader</code> and <code>ImageWriter</code>.
 *
 * @param reader an <code>ImageReader</code>.
 * @param writer an <code>ImageWriter</code>.
 *
 * @return an <code>Iterator</code> containing
 * <code>ImageTranscoder</code>s.
 *
 * @exception IllegalArgumentException if <code>reader</code> or
 * <code>writer</code> is <code>null</code>.
 */
public static Iterator<ImageTranscoder>
    getImageTranscoders(ImageReader reader, ImageWriter writer)
{
    if (reader == null) {
        throw new IllegalArgumentException("reader == null!");
    }
    if (writer == null) {
        throw new IllegalArgumentException("writer == null!");
    }
    ImageReaderSpi readerSpi = reader.getOriginatingProvider();
    ImageWriterSpi writerSpi = writer.getOriginatingProvider();
    ServiceRegistry.Filter filter =
        new TranscoderFilter(readerSpi, writerSpi);

    Iterator iter;
    // Ensure category is present
    try {
        iter = theRegistry.getServiceProviders(ImageTranscoderSpi.class,
                                        filter, true);
    } catch (IllegalArgumentException e) {
        return Collections.emptyIterator();
    }
    return new ImageTranscoderIterator(iter);
}
 
Example #19
Source File: WBMPImageWriterSpi.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }

    registered = true;
}
 
Example #20
Source File: BMPImageWriterSpi.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }

    registered = true;
}
 
Example #21
Source File: WBMPImageWriterSpi.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }

    registered = true;
}
 
Example #22
Source File: BMPImageReaderSpi.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }
    registered = true;
}
 
Example #23
Source File: BMPImageWriterSpi.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }

    registered = true;
}
 
Example #24
Source File: WBMPImageWriterSpi.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }

    registered = true;
}
 
Example #25
Source File: BMPImageWriterSpi.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }

    registered = true;
}
 
Example #26
Source File: BMPImageReaderSpi.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }
    registered = true;
}
 
Example #27
Source File: BMPImageReaderSpi.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }
    registered = true;
}
 
Example #28
Source File: BMPImageWriterSpi.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }

    registered = true;
}
 
Example #29
Source File: BMPImageReaderSpi.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void onRegistration(ServiceRegistry registry,
                           Class<?> category) {
    if (registered) {
        return;
    }
    registered = true;
}
 
Example #30
Source File: SPIServiceRegistry.java    From geowave with Apache License 2.0 5 votes vote down vote up
public <T> Iterator<T> load(final Class<T> service) {

    final Set<ClassLoader> checkset = new HashSet<>();
    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 = ServiceRegistry.lookupProviders(service, l);
        }
        return (spiIT != null) && spiIT.hasNext();
      }

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

      @Override
      public void remove() {}
    };
  }