net.larsan.urd.archive
Class ArchiveLoader

java.lang.Object
  |
  +--java.lang.ClassLoader
        |
        +--java.security.SecureClassLoader
              |
              +--net.larsan.urd.util.ResourceClassLoader
                    |
                    +--net.larsan.urd.archive.ArchiveLoader

public class ArchiveLoader
extends ResourceClassLoader

A secure class loader for a norna archive. The archive loader holds a reference to the shared class loaders. On creation this loader hashes the service exported/imported packages for fast access and will later use the shared space for all classes from the exported/imported package hash.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson
See Also:
SharedSpace

Field Summary
 
Fields inherited from class net.larsan.urd.util.ResourceClassLoader
locator
 
Constructor Summary
ArchiveLoader(java.lang.ClassLoader parent, JarArchive archive, SharedSpace space)
          Create the class loader from a JAR archive.
 
Method Summary
protected  java.net.URL findResource(java.lang.String name)
          Find resource from the frameworks.
protected  java.security.PermissionCollection getPermissions(java.security.CodeSource src)
          Get the permissions for this archive.
 java.lang.Class loadClass(java.lang.String name)
          Load class from the frameworks.
 
Methods inherited from class net.larsan.urd.util.ResourceClassLoader
findClass, findResources, getCodeSource
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArchiveLoader

public ArchiveLoader(java.lang.ClassLoader parent,
                     JarArchive archive,
                     SharedSpace space)
Create the class loader from a JAR archive. The shared space will be used to export the archive into and load exported/imported classes from.

Parameters:
archive - JAR archive to load resource from
space - Shared class/package space
Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Load class from the frameworks. This method delegates to the shared class space if the class is exported/imported be the current service.

Overrides:
loadClass in class ResourceClassLoader
Parameters:
name - Fully qualified class name
Returns:
A class object
Throws:
java.lang.ClassNotFoundException - If the class is not found

findResource

protected java.net.URL findResource(java.lang.String name)
Find resource from the frameworks. This method delegates to the shared class space if the class is exported/imported be the current service.

Overrides:
findResource in class ResourceClassLoader
Parameters:
name - Resource name
Returns:
The resource URL, or null if not found

getPermissions

protected java.security.PermissionCollection getPermissions(java.security.CodeSource src)
Get the permissions for this archive. This will take the superclass permissions and add package "load" permissions for all imported and exported packages. It will alse add a thread scope permission for the class.

Overrides:
getPermissions in class ResourceClassLoader
Parameters:
src - Code source, ignored in his loader
Returns:
The system permissions for the code source