ExtensionDependency.java revision 28
0N/A * Copyright 1999-2006 Sun Microsystems, Inc. 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 0N/A * published by the Free Software Foundation. Sun designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Sun 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. 0N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 0N/A * CA 95054 USA or visit www.sun.com if you need additional information or 0N/A * have any questions. 0N/A * This class checks dependent extensions a particular jar file may have 0N/A * declared through its manifest attributes. 0N/A * Jar file declared dependent extensions through the extension-list 0N/A * attribute. The extension-list contains a list of keys used to 0N/A * fetch the other attributes describing the required extension. 0N/A * If key is the extension key declared in the extension-list 0N/A * attribute, the following describing attribute can be found in 0N/A * key-Extension-Name: (Specification package name) 0N/A * key-Specification-Version: (Specification-Version) 0N/A * key-Implementation-Version: (Implementation-Version) 0N/A * key-Implementation-Vendor-Id: (Imlementation-Vendor-Id) 0N/A * key-Implementation-Version: (Implementation version) 0N/A * key-Implementation-URL: (URL to download the requested extension) 0N/A * This class also maintain versioning consistency of installed 0N/A * extensions dependencies declared in jar file manifest. 0N/A * @author Jerome Dochez 0N/A /* Callbak interfaces to delegate installation of missing extensions */ 0N/A * Register an ExtensionInstallationProvider. The provider is responsible 0N/A * for handling the installation (upgrade) of any missing extensions. 0N/A * @param eip ExtensionInstallationProvider implementation 0N/A * Unregister a previously installed installation provider 0N/A * Checks the dependencies of the jar file on installed extension. 0N/A * @param jarFile containing the attriutes declaring the dependencies 0N/A // no need to bother, nobody is registered to install missing 0N/A * Check for all declared required extensions in the jar file 0N/A // The applet does not define a manifest file, so 0N/A // we just assume all dependencies are satisfied. 0N/A // Let's get the list of declared dependencies 0N/A // Iterate over all declared dependencies 0N/A " appers to depend on " 0N/A * Check that a particular dependency on an extension is satisfied. 0N/A * @param extensionName is the key used for the attributes in the manifest 0N/A * @param attr is the attributes of the manifest file 0N/A * @return true if the dependency is satisfied by the installed extensions 0N/A debug(
"Extension not currently installed ");
0N/A * Check if a particular extension is part of the currently installed 0N/A * @param extensionName is the key for the attributes in the manifest 0N/A * @param attr is the attributes of the manifest 0N/A * @return true if the requested extension is already installed 0N/A // Extension already installed, just check against this one 0N/A // Not sure if extension is already installed, so check all the 0N/A // installed extension jar files to see if we get a match 0N/A // Get the list of installed extension jar files so we can 0N/A // compare the installed versus the requested extension 0N/A // let's continue with the next installed extension 0N/A * Check if the requested extension described by the attributes 0N/A * in the manifest under the key extensionName is compatible with 0N/A * @param extensionName key in the attibute list 0N/A * @param attr manifest file attributes 0N/A * @param file installed extension jar file to compare the requested 0N/A * extension against. 0N/A // Load the jar file ... 0N/A // Construct the extension information object 0N/A debug(
"Extensions require an upgrade or vendor switch");
0N/A * An required extension is missing, if an ExtensionInstallationProvider is 0N/A * registered, delegate the installation of that particular extension to it. 0N/A * @param reqInfo Missing extension information 0N/A * @param instInfo Older installed version information 0N/A * @return true if the installation is successful 0N/A // delegate the installation to the provider 0N/A // We have tried all of our providers, noone could install this 0N/A // extension, we just return failure at this point 0N/A * Checks if the extension, that is specified in the extension-list in 0N/A * the applet jar manifest, is already installed (i.e. exists in the 0N/A * extension directory). 0N/A * @param extensionName extension name in the extension-list 0N/A * @return the extension if it exists in the extension directory 0N/A // Function added to fix bug 4504166 0N/A // Search the extension directories for the extension that is specified 0N/A // in the attribute extension-list in the applet jar manifest 0N/A * @return the java.ext.dirs property as a list of directory 0N/A * Scan the directories and return all files installed in those 0N/A * @param dirs list of directories to scan 0N/A * @return the list of files installed in all the directories 0N/A * @return the list of installed extensions jar files 0N/A debug(
"Cannot get list of installed extensions");
0N/A * Add the newly installed jar file to the extension class loader. 0N/A * @param cl the current installed extension class loader 0N/A * @return true if successful 0N/A debug(
"Not Found ! adding to the classloader " +
0N/A // let's continue with the next installed extension 0N/A // True to display all debug and trace messages