|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.extension.ExtensionManager
public class ExtensionManager
Extension Manager.
This class is used to manage the extension in an independant manner. It can use services like extension or Eclipse extension points, depending on the running platform.
As the runtime can be shared by multiple J2EE applications, some extensions can be defined globally (e.g. for all the applications) or on a per application basis.
Nested Class Summary | |
---|---|
static interface |
ExtensionManager.ApplicationClassLoader
Interface that defines an application classloader. |
Constructor Summary | |
---|---|
ExtensionManager()
|
Method Summary | ||
---|---|---|
static java.util.List<java.lang.Object> |
findApplicationServices(java.lang.ClassLoader loader,
java.lang.String serviceType)
Find the available implementations of a service for a particular Application. |
|
static java.util.List<java.lang.Object> |
findApplicationServices(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> services,
java.lang.ClassLoader loader,
java.lang.String serviceType)
Find the available implementations of a service for a particular Application. |
|
static java.util.List<java.lang.Object> |
findServices(java.util.List<java.lang.Object> list,
java.lang.Class<?> clazz,
java.lang.String serviceType)
Find the globally available implementations of a service. |
|
static java.util.List<java.lang.Object> |
findServices(java.util.List<java.lang.Object> list,
java.lang.ClassLoader loader,
java.lang.String serviceType)
Find the globally available implementations of a service. |
|
static
|
findServices(java.util.List<T> existingList,
java.lang.ClassLoader loader,
java.lang.String serviceType,
java.lang.Class<T> requiredType)
Find the globally available implementations of a service. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtensionManager()
Method Detail |
---|
public static java.util.List<java.lang.Object> findApplicationServices(java.lang.ClassLoader loader, java.lang.String serviceType)
This includes both the globally available services as well as the one defined in the application class loader as well. The global services are generally read from the Eclipse extension points while the per application are read using the services definition (until OSGi will be available everywhere....)
The result is a list of service implementations (concrete classes)
loader
- the class loader used to load the servicesserviceType
- the name of the service to load
public static java.util.List<java.lang.Object> findApplicationServices(java.util.Map<java.lang.String,java.util.List<java.lang.Object>> services, java.lang.ClassLoader loader, java.lang.String serviceType)
Similar to com.ibm.commons.extension.ExtensionManager.findApplicationServices(ClassLoader, String) but it also manages a cache which prevents the resources to be read if not necessary.
services
- the Map that holds the cache. Must be one instance per Applicationloader
- the class loader used to load the servicesserviceType
- the name of the service to load
public static java.util.List<java.lang.Object> findServices(java.util.List<java.lang.Object> list, java.lang.Class<?> clazz, java.lang.String serviceType)
The list only contained the services that are shared, and not the application specific ones.
list
- an optional list containing the services. If not null, then it is returnedclazz
- the class to get the class loader for loading the servicesserviceType
- the name of the service to load
public static java.util.List<java.lang.Object> findServices(java.util.List<java.lang.Object> list, java.lang.ClassLoader loader, java.lang.String serviceType)
The list only contained the services that are shared, and not the application specific ones.
list
- an optional list containing the services. If not null, then it is returnedclassloader
- The class loader to look for the servicesserviceType
- the name of the service to load
public static <T> java.util.List<T> findServices(java.util.List<T> existingList, java.lang.ClassLoader loader, java.lang.String serviceType, java.lang.Class<T> requiredType)
This is the type safety implementation of the method using generics. The content of the list is checked to ensure that all the implementations belong to the correct type.
T
- existingList
- already loaded service list; the services will only be loaded
if list is null
.loader
- ClassLoader to use when loading the classes in a non-OSGI
environment.serviceType
- service id.requiredType
- Class
to be implemented by all contributing services.
Services which do not implement that class will generate a
warning and will not be included in the result List
.
When null
no class validation is performed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |