|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
org.crosswire.common.util.CWClassLoader
public class CWClassLoader
CWClassLoader extends the regular class loader by using looking in more places. This is needed so that ResourceBundle can find resources that are not held in the same package as the class.
Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors. |
Licence
Field Summary | |
---|---|
private static URL |
home
Notion of a project's home from where additional resources can be found. |
private Class |
owner
The class to which the resources belong |
Constructor Summary | |
---|---|
CWClassLoader()
Creates a class loader that finds resources for the calling class that may not be in the class' package. |
|
CWClassLoader(Class resourceOwner)
Creates a class loader that finds resources for the supplied class that may not be in the class' package. |
Method Summary | |
---|---|
private String |
adjustPackageSearch(String search)
Prefix the search with a package prefix, if not already. |
private String |
adjustPathSearch(String search)
Change all but a leading '/' to '.' |
static URL |
findHomeResource(String search)
Look for the resource in the home directory |
URL |
findResource(String search)
|
ClassLoader |
getClassLoader()
|
static URL |
getHome()
If the application has set the home, it will return the application's home directory, otherwise it returns null. |
private static ClassLoader |
pickLoader(ClassLoader loader1,
ClassLoader loader2)
Returns 'true' if 'loader2' is a delegation child of 'loader1' [or if 'loader1'=='loader2']. |
static void |
setHome(URL newhome)
Establish the applications home directory from where additional resources can be found. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Class owner
private static URL home
Constructor Detail |
---|
public CWClassLoader(Class resourceOwner)
resourceOwner
- is the owner of the resourcepublic CWClassLoader()
Method Detail |
---|
public URL findResource(String search)
findResource
in class ClassLoader
private String adjustPackageSearch(String search)
private String adjustPathSearch(String search)
public ClassLoader getClassLoader()
private static ClassLoader pickLoader(ClassLoader loader1, ClassLoader loader2)
public static URL getHome()
public static void setHome(URL newhome)
newhome
- The home to set.public static URL findHomeResource(String search)
search
- must be non-null, non-empty
|
Copyright ? 2003-2004 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |