Package org.nuxeo.ecm.webengine.jaxrs
Class Utils
java.lang.Object
org.nuxeo.ecm.webengine.jaxrs.Utils
Some helper methods for parsing configuration and loading contributed servlets or filters.
- Author:
- Bogdan Stefanescu
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Utils.ClassRef
getClassRef
(String classRef) Get a class proxy reference for the given class referencestatic Utils.ClassRef
getClassRef
(String classRef, org.osgi.framework.Bundle bundle) static Class<?>
Load a class from a class reference string.static Class<?>
Load a class given the owner bundle and the class name.static Class<?>[]
loadClasses
(String classRefs) Load classes from a list of class references given as a comma separated string list.static Class<?>[]
loadClasses
(String classRefs, char sep) Load classes from a list of class references given as a 'sep' separated string list.static Object
newInstance
(String classRef) Create a new object of the given a class reference.static Object
newInstance
(String bundleId, String className) Create a new object of the given class in the given bundle.static <T> T[]
newInstances
(Class<T> componentType, String classRefs) Get class instances for the given class references stringstatic <T> T[]
newInstances
(Class<T> componentType, String classRefs, char sep) Get class instances for the given class references string
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
loadClasses
public static Class<?>[] loadClasses(String classRefs) throws ClassNotFoundException, BundleNotFoundException Load classes from a list of class references given as a comma separated string list.- Parameters:
classRefs
- the string containing the list of class references- Returns:
- an array of the loaded classes
- Throws:
ClassNotFoundException
BundleNotFoundException
-
loadClasses
public static Class<?>[] loadClasses(String classRefs, char sep) throws ClassNotFoundException, BundleNotFoundException Load classes from a list of class references given as a 'sep' separated string list.- Parameters:
classRefs
- the string containing the list of class referencessep
- the separator character used to separate class references in the string.- Returns:
- an array of the loaded classes
- Throws:
ClassNotFoundException
BundleNotFoundException
-
newInstances
public static <T> T[] newInstances(Class<T> componentType, String classRefs) throws ReflectiveOperationException, BundleNotFoundException Get class instances for the given class references string- Parameters:
componentType
- the type of the expected array component- Throws:
ReflectiveOperationException
BundleNotFoundException
- See Also:
-
newInstances
public static <T> T[] newInstances(Class<T> componentType, String classRefs, char sep) throws ReflectiveOperationException, BundleNotFoundException Get class instances for the given class references string- Throws:
ReflectiveOperationException
BundleNotFoundException
- See Also:
-
loadClass
public static Class<?> loadClass(String classRef) throws ClassNotFoundException, BundleNotFoundException Load a class from a class reference string. The class reference string is in the format:bundleSymbolicName:className
orclassName
. If no bundle symbolic name is given the class will be loaded using the class loader of theUtils
class.The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
-
getClassRef
public static Utils.ClassRef getClassRef(String classRef) throws ClassNotFoundException, BundleNotFoundException Get a class proxy reference for the given class reference -
getClassRef
public static Utils.ClassRef getClassRef(String classRef, org.osgi.framework.Bundle bundle) throws ClassNotFoundException, BundleNotFoundException -
loadClass
public static Class<?> loadClass(String bundleId, String className) throws ClassNotFoundException, BundleNotFoundException Load a class given the owner bundle and the class name.The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
-
newInstance
public static Object newInstance(String bundleId, String className) throws ReflectiveOperationException, BundleNotFoundException Create a new object of the given class in the given bundle. The class should provide a no-args empty constructor.The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
- Throws:
ReflectiveOperationException
BundleNotFoundException
- See Also:
-
newInstance
public static Object newInstance(String classRef) throws ReflectiveOperationException, BundleNotFoundException Create a new object of the given a class reference.The bundle will be resolved to the last version of the bundle (in case when different bundle versions are found)
- Throws:
ReflectiveOperationException
BundleNotFoundException
- See Also:
-