Package org.synchronoss.cpo.core.helper
Class CpoClassLoader
java.lang.Object
org.synchronoss.cpo.core.helper.CpoClassLoader
This is a proxy class designed to handle the different classloaders needed when running in a
container as a skinny war versus running from the console.
Currently check the classloader for cpo first, then use the contextClassloader second.
- Author:
- dberry
-
Method Summary
Modifier and TypeMethodDescriptionstatic Class<?> Loads a class by name, first via the normalClass.forName(String)lookup, then falling back to the current thread's context classloader.static InputStreamgetResourceAsStream(String name) Loads a classpath resource, first via this class's own classloader, then falling back to the current thread's context classloader.
-
Method Details
-
getResourceAsStream
Loads a classpath resource, first via this class's own classloader, then falling back to the current thread's context classloader.- Parameters:
name- the resource name to load- Returns:
- an open stream for the resource, or
nullif it could not be found by either classloader
-
forName
Loads a class by name, first via the normalClass.forName(String)lookup, then falling back to the current thread's context classloader.- Parameters:
className- the fully qualified name of the class to load- Returns:
- the loaded
Class - Throws:
ClassNotFoundException- if the class could not be found by either classloader
-