|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.scopemvc.util.ResourceLoader
Utility class for loading resources.
This class fixes an issue where the Scope library wants to load a resource
belonging to a client jar, but cannot find it because of the resource is not
accessible from the scope classloader.
The solution is to give access from Scope to the client classloader, i.e the
classloader used to load the client jars containing the application
resources.
User code needs to set the client classloader with ResourceLoader.setClientClassLoader
before Scope can load the client resources.
setClientClassLoader(java.lang.ClassLoader)
Method Summary | |
static java.lang.ClassLoader |
getClientClassLoader()
Gets the client class loader. |
static java.lang.ClassLoader |
getClientLoader()
Gets the client loader |
static javax.swing.Icon |
getIcon(java.lang.String iconPath)
Gets the icon |
static java.awt.Image |
getImage(java.lang.String imagePath)
Gets the image |
static java.util.ResourceBundle |
getProperties(java.lang.String inPropertiesName)
Try to return a ResourceBundle loaded from the named resource, or null if can't load. |
static java.net.URL |
getResource(java.lang.String resourcePath)
Gets the resource |
static void |
setClientClassLoader(java.lang.ClassLoader cl)
Sets the client class loader used to load the resources. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static java.lang.ClassLoader getClientLoader()
public static javax.swing.Icon getIcon(java.lang.String iconPath)
iconPath
- Description of the Parameter
public static java.awt.Image getImage(java.lang.String imagePath)
imagePath
- Description of the Parameter
public static java.net.URL getResource(java.lang.String resourcePath)
resourcePath
- Description of the Parameter
public static java.util.ResourceBundle getProperties(java.lang.String inPropertiesName)
inPropertiesName
- TODO: Describe the Parameter
public static java.lang.ClassLoader getClientClassLoader()
public static void setClientClassLoader(java.lang.ClassLoader cl)
class MyLauncher { public static void main(String[] args) { ResourceLoader.setClientClassLoader(MyLauncher.class.getClassLoader()); // starts Scope application MyController controller = new MyController(); controller.startUp(); } }
cl
- The new clientClassLoader value
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |