2362N/A * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A registry for service provider instances. Service provider 0N/A * classes may be detected at run time by means of meta-information in 0N/A * the JAR files containing them. The intent is that it be relatively 0N/A * inexpensive to load and inspect all available service provider 0N/A * classes. These classes may them be used to locate and instantiate 0N/A * more heavyweight classes that will perform actual work, in this 0N/A * case instances of <code>ImageReader</code>, 0N/A * <code>ImageWriter</code>, <code>ImageTranscoder</code>, 0N/A * <code>ImageInputStream</code>, and <code>ImageOutputStream</code>. 0N/A * <p> Service providers found on the system classpath (<i>e.g.</i>, 0N/A * the <code>jre/lib/ext</code> directory in Sun's implementation of 0N/A * JDK) are automatically loaded as soon as this class is 0N/A * <p> When the <code>registerApplicationClasspathSpis</code> method 0N/A * is called, service provider instances declared in the 0N/A * meta-information section of JAR files on the application class path 0N/A * are loaded. To declare a service provider, a <code>services</code> 0N/A * subdirectory is placed within the <code>META-INF</code> directory 0N/A * that is present in every JAR file. This directory contains a file 0N/A * for each service provider interface that has one or more 0N/A * implementation classes present in the JAR file. For example, if 0N/A * the JAR file contained a class named 0N/A * <code>com.mycompany.imageio.MyFormatReaderSpi</code> which 0N/A * implements the <code>ImageReaderSpi</code> interface, the JAR file 0N/A * would contain a file named: 0N/A * containing the line: 0N/A * com.mycompany.imageio.MyFormatReaderSpi 0N/A * <p> The service provider classes are intended to be lightweight 0N/A * and quick to load. Implementations of these interfaces 0N/A * should avoid complex dependencies on other classes and on 0N/A * <p> It is also possible to manually add service providers not found 0N/A * automatically, as well as to remove those that are using the 0N/A * interfaces of the <code>ServiceRegistry</code> class. Thus 0N/A * the application may customize the contents of the registry as it 0N/A * <p> For more details on declaring service providers, and the JAR 0N/A * format in general, see the <a 0N/A * JAR File Specification</a>. 0N/A * A <code>Vector</code> containing the valid IIO registry 0N/A * categories (superinterfaces) to be used in the constructor. 0N/A * Set up the valid service provider categories and automatically 0N/A * register all available service providers. 0N/A * <p> The constructor is private in order to prevent creation of 0N/A * additional instances. 0N/A * Returns the default <code>IIORegistry</code> instance used by 0N/A * the Image I/O API. This instance should be used for all 0N/A * registry functions. 0N/A * <p> Each <code>ThreadGroup</code> will receive its own 0N/A * instance; this allows different <code>Applet</code>s in the 0N/A * same browser (for example) to each have their own registry. 0N/A * @return the default registry for the current 0N/A * <code>ThreadGroup</code>. 0N/A // Create an instance for this AppContext 0N/A // Hardwire standard SPIs 0N/A * Registers all available service providers found on the 0N/A * application class path, using the default 0N/A * <code>ClassLoader</code>. This method is typically invoked by 0N/A * the <code>ImageIO.scanForPlugins</code> method. 0N/A * @see javax.imageio.ImageIO#scanForPlugins 0N/A * @see ClassLoader#getResources 0N/A // FIX: load only from application classpath 0N/A // Note that the next() call is required to be inside 0N/A // In the applet case, we will catch the error so 0N/A // registration of other plugins can proceed 0N/A // In the application case, we will throw the 0N/A We need load installed providers from lib/ext 0N/A directory in the privileged mode in order to 0N/A be able read corresponding jar files even if 0N/A file read capability is restricted (like the 0N/A applet context case).