1/*
2 * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24import java.io.IOException;
25import java.util.Locale;
26
27import javax.imageio.IIOException;
28import javax.imageio.ImageReader;
29import javax.imageio.spi.ImageReaderSpi;
30import javax.imageio.spi.ServiceRegistry;
31
32public class DummyReaderPluginSpi extends ImageReaderSpi {
33
34    private static String [] writerSpiNames =
35        {"DummyWriterPluginSpi"};
36    public static String[] formatNames = {"test_5076692", "TEST_5076692"};
37    public static String[] entensions = {"test_5076692"};
38    public static String[] mimeType = {"image/test_5076692"};
39
40    private boolean registered = false;
41
42    public DummyReaderPluginSpi() {
43        super("Sun Microsystems, Inc.",
44              "1.0",
45              formatNames,
46              entensions,
47              mimeType,
48              "DummyPluginReader",
49              STANDARD_INPUT_TYPE,
50              writerSpiNames,
51              false,
52              null, null, null, null,
53              false,
54              "",
55              "",
56              null, null);
57    }
58
59    public void onRegistration(ServiceRegistry registry,
60                               Class<?> category) {
61        if (registered) {
62            return;
63        }
64
65        System.getProperty("test.5076692.property", "not found");
66
67        registered = true;
68    }
69
70    public String getDescription(Locale locale) {
71        return "Standard Dummy Image Reader";
72    }
73
74    public boolean canDecodeInput(Object source) throws IOException {
75        return false;
76    }
77
78    public ImageReader createReaderInstance(Object extension)
79        throws IIOException {
80        return null;
81    }
82}
83