Java URL - ArchitectureThe Resource ManagerThe resource manager is the heart of the launcher. Its job is to supply the application with the resources it needs, whether they are local or remote. If a resource is downloaded from the network, it is stored in a cache for quicker access in the future. The resource manager implementation is separate from that of the loaders and caches to enable support of various protocols and storage devices. Loading and caching are performed on their own thread, so a launched application may be loading and caching resources in the background. LoadersLoaders supply two things:
The default loader is an HTTP loader that simply obtains the catalog (a JNLP XML file) and resources from a web server. Loaders can be created for more sophisticated technologies, such as CORBA and Universal Plug and Play. Currently, Java URL considers the loader's catalog to be static, meaning that it is only necessary to retrieve it once. CachesCaches are special cases of loaders that can also store resources as well as retrieve them. Caches also keep track of the validity of their resources, so that their versions can be validated against versions from the loader. Each cache is created specifically for the URL, so in effect each URL should have its own cache partition. The cache's catalog is necessarily dynamic, as the cache contents change. The Class LoaderThe launcher's class loader simply forwards its requests to the resource manager, and waits for them to be serviced (by the resource manager's loading thread). The Security ManagerThe launcher's security manager divides the process into two thread groups:
Note that the launched application is not even allowed access to its own cache, so it cannot "fiddle" with it. If the security manager comes across an intrusive action, it gives the user the option to allow or deny it, and to remember this choice for future actions that are identical (for example, for reading the same file) or are of the same "class" of actions (for example, for reading all files from the same directory). Launch Sequence
Whenever the class loader cannot find a class or resource using the default mechanism, it requests it from the resource manager. The resource manager looks for this resource in the catalog, and either retrieves it directly, or retrieves its JAR. According to dependencies set in the catalog, this may involve loading other resources, too. Resources are always retrieved from the cache if they are already there in the correct version. (Java and all Java-based marks are trademarks
or registered trademarks of Sun Microsystems, Inc. in the U.S. and other
countries. |