public void addConstituent( URL constituent ) { classLoader.addConstituent( constituent ); }
public Enumeration findResources(String name) throws IOException { return getRealm().findResources( name ); }
public URL[] getConstituents() { return classLoader.getURLs(); }
return super.loadClassDirect( className );
public DefaultClassRealm( ClassWorld world, String id, ClassLoader foreignClassLoader ) { this.world = world; this.id = id; imports = new TreeSet(); if ( foreignClassLoader != null ) { this.foreignClassLoader = foreignClassLoader; } if ( "true".equals( System.getProperty( "classworlds.bootstrapped" ) ) ) { classLoader = new UberJarRealmClassLoader( this ); } else { classLoader = new RealmClassLoader( this ); } }
addURL( constituent ); byte[] b = getBytesToEndOfStream( new DataInputStream( constituent.openStream() ) ); int start = urlStr.lastIndexOf("byteclass") + 10; int end = urlStr.lastIndexOf(".class"); addURL(constituent);
for ( Enumeration direct = classLoader.findResourcesDirect(name); direct.hasMoreElements(); )
URL loadResourceDirect( String name ) { // 1. Try this realm's ClassLoader. // 2. If the realm has a parent try the parent's ClassLoader. URL resource = this.classLoader.findResource( name ); if ( resource == null && getParent() != null ) { resource = getParent().getResource( name ); } return resource; }
resource = classLoader.getResourceDirect( name ); resource = classLoader.getResourceDirect( name );
/** Load a class. * * @param name The name of the class to load. * * @return The loaded class. * * @throws ClassNotFoundException If the class cannot be found. */ Class loadClassDirect( String name ) throws ClassNotFoundException { // 1. Try this realm's ClassLoader. // 2. If the realm has a parent try the parent's ClassLoader. Class clazz = null; try { clazz = this.classLoader.loadClassDirect( name ); } catch ( ClassNotFoundException cnfe1 ) { if ( getParent() != null ) { clazz = getParent().getClassLoader().loadClass( name ); } else { throw cnfe1; } } return clazz; }
/** Construct. * * @param world The world of which this realm is a member. * @param id This realm's id. */ DefaultClassRealm( ClassWorld world, String id ) { this.world = world; this.id = id; this.imports = new TreeSet(); // We need to detect whether we are running in an UberJar // or not. if ( "true".equals( System.getProperty( "classworlds.bootstrapped" ) ) ) { this.classLoader = new UberJarRealmClassLoader( this ); } else { this.classLoader = new RealmClassLoader( this ); } }
/** Add a constituent to this realm for locating classes. * * @param constituent URL to contituent jar or directory. */ public void addConstituent( URL constituent ) { this.classLoader.addConstituent( constituent ); }
public URL getResource(String name) { return getRealm().getResource( name ); }
return classLoader.loadClassDirect( name ); return classLoader.loadClassDirect( name );
public void addConstituent( URL constituent ) { // If the constituent is a jar, build an index for it. if ( "jar".equals( constituent.getProtocol() ) || constituent.toExternalForm().endsWith( ".jar" ) ) { buildIndexForJar( constituent ); } // Add the constituent to the urls collection this.urls.add( constituent ); super.addConstituent( constituent ); }
/** Load a class. * * @param name The name of the class to load. * @param resolve If <code>true</code> then resolve the class. * * @return The loaded class. * * @throws ClassNotFoundException If the class cannot be found. */ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { return getRealm().loadClass( name ); }
/** Add a constituent to this realm for locating classes. * * @param constituent URL to contituent jar or directory. */ void addConstituent( URL constituent ) { // If the constituent is a jar, build an index for it. if ( "jar".equals( constituent.getProtocol() ) || constituent.toExternalForm().endsWith( ".jar" ) ) { buildIndexForJar( constituent ); } // Add the constituent to the urls collection this.urls.add( constituent ); super.addConstituent( constituent ); }
/** Load a class. * * @param name The name of the class to load. * @param resolve If <code>true</code> then resolve the class. * * @return The loaded class. * * @throws ClassNotFoundException If the class cannot be found. */ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException { return getRealm().loadClass( name ); }