View Javadoc
1 2 package com.werken.forehead; 3 4 /* 5 $Id: ForeheadClassLoader.java,v 1.1.1.1 2002/06/19 13:50:59 werken Exp $ 6 7 Copyright 2001 (C) The Werken Company. All Rights Reserved. 8 9 Redistribution and use of this software and associated documentation 10 ("Software"), with or without modification, are permitted provided 11 that the following conditions are met: 12 13 1. Redistributions of source code must retain copyright 14 statements and notices. Redistributions must also contain a 15 copy of this document. 16 17 2. Redistributions in binary form must reproduce the 18 above copyright notice, this list of conditions and the 19 following disclaimer in the documentation and/or other 20 materials provided with the distribution. 21 22 3. The name "Forehead" must not be used to endorse or promote 23 products derived from this Software without prior written 24 permission of The Werken Company. For written permission, 25 please contact bob@werken.com. 26 27 4. Products derived from this Software may not be called "Forehead" 28 nor may "Forehead" appear in their names without prior written 29 permission of The Werken Company. Forehead is a registered 30 trademark of The Werken Company. 31 32 5. Due credit should be given to the Forehead Project 33 (http://drools.org/). 34 35 THIS SOFTWARE IS PROVIDED BY THE WERKEN COMPANY AND CONTRIBUTORS 36 ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 37 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 38 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 39 THE WERKEN COMPANY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 40 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 41 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 42 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 43 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 44 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 45 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 46 OF THE POSSIBILITY OF SUCH DAMAGE. 47 48 */ 49 50 import java.net.URL; 51 import java.net.URLClassLoader; 52 53 /*** Named, dynamically modifiable ClassLoader implementation. 54 * 55 * @see Forehead 56 * 57 * @author <a href="mailto:bob@eng.werken.com">bob mcwhirter</a> 58 */ 59 public class ForeheadClassLoader extends URLClassLoader 60 { 61 // ------------------------------------------------------------ 62 // Constants 63 // ------------------------------------------------------------ 64 65 /*** Simple empty URL[0] array. */ 66 public static final URL[] EMPTY_URL_ARRAY = new URL[0]; 67 68 // ------------------------------------------------------------ 69 // Instance members 70 // ------------------------------------------------------------ 71 72 /*** The name of this loader. */ 73 private String name; 74 75 // ------------------------------------------------------------ 76 // Constructors 77 // ------------------------------------------------------------ 78 79 /*** Construct given a parent and a name. 80 * 81 * @param parent The parent loader. 82 * @param name The name of this loader. 83 */ 84 public ForeheadClassLoader(ClassLoader parent, 85 String name) 86 { 87 super( EMPTY_URL_ARRAY, 88 parent ); 89 90 this.name = name; 91 } 92 93 // ------------------------------------------------------------ 94 // Instance methods 95 // ------------------------------------------------------------ 96 97 /*** Retrieve the name of this ClassLoader. 98 * 99 * @return The name of this loader. 100 */ 101 public String getName() 102 { 103 return this.name; 104 } 105 106 /*** Append a URL to this loader's search path. 107 * 108 * @param url The URL to append. 109 */ 110 public void addURL(URL url) 111 { 112 super.addURL( url ); 113 } 114 115 // ------------------------------------------------------------ 116 // java.lang.Object implementation 117 // ------------------------------------------------------------ 118 119 /*** Produce output suitable for debugging. 120 * 121 * @return Output suitable for debugging. 122 */ 123 public String toString() 124 { 125 return "[ForeheadClassLoader: name=\"" + getName() + "\"]"; 126 } 127 }

This page was automatically generated by Maven