public class ComponentAnnotationLoader extends Object
Modifier and Type | Field and Description |
---|---|
static String |
COMPONENT_LIST
Location in the classloader of the file defining the list of component implementation class to parser for
annotations.
|
static String |
COMPONENT_OVERRIDE_LIST
Deprecated.
starting with 3.3M1 use the notion of priorities instead (see
ComponentDeclaration ). |
Constructor and Description |
---|
ComponentAnnotationLoader() |
Modifier and Type | Method and Description |
---|---|
Set<Class<?>> |
findComponentRoleClasses(Class<?> componentClass)
Deprecated.
since 4.0M1 use
findComponentRoleTypes(Class) instead |
Set<Type> |
findComponentRoleTypes(Class<?> componentClass) |
Set<Type> |
findComponentRoleTypes(Class<?> componentClass,
Type[] parameters) |
List<ComponentDescriptor<?>> |
getComponentsDescriptors(Class<?> componentClass) |
List<ComponentDeclaration> |
getDeclaredComponents(ClassLoader classLoader,
String location)
Get all components listed in the passed resource file.
|
List<ComponentDeclaration> |
getDeclaredComponents(InputStream componentListStream)
Get all components listed in the passed resource stream.
|
List<ComponentDeclaration> |
getDeclaredComponentsFromJAR(InputStream jarFile)
Get all components listed in a JAR file.
|
protected org.slf4j.Logger |
getLogger()
Useful for unit tests that need to capture logs; they can return a mock logger instead of the real logger and
thus assert what's been logged.
|
void |
initialize(ComponentManager manager,
ClassLoader classLoader)
Loads all components defined using annotations.
|
void |
initialize(ComponentManager manager,
ClassLoader classLoader,
List<ComponentDeclaration> componentDeclarations) |
void |
register(ComponentManager manager,
ClassLoader classLoader,
List<ComponentDeclaration> componentDeclarations) |
void |
register(ComponentManager manager,
Collection<ComponentDescriptor<?>> componentDescriptors) |
void |
unregister(ComponentManager manager,
ClassLoader classLoader,
List<ComponentDeclaration> componentDeclarations) |
public static final String COMPONENT_LIST
@Deprecated public static final String COMPONENT_OVERRIDE_LIST
ComponentDeclaration
).public void initialize(ComponentManager manager, ClassLoader classLoader)
manager
- the component manager to use to dynamically register componentsclassLoader
- the classloader to use to look for the Component list declaration file (
META-INF/components.txt
)public void initialize(ComponentManager manager, ClassLoader classLoader, List<ComponentDeclaration> componentDeclarations)
manager
- the component manager to use to dynamically register componentsclassLoader
- the classloader to use to look for the Component list declaration file (
META-INF/components.txt
)componentDeclarations
- the declarations of components to registerpublic void register(ComponentManager manager, Collection<ComponentDescriptor<?>> componentDescriptors)
manager
- the component manager to use to dynamically register componentscomponentDescriptors
- the descriptors of components to registerpublic void register(ComponentManager manager, ClassLoader classLoader, List<ComponentDeclaration> componentDeclarations)
manager
- the component manager to use to dynamically register componentsclassLoader
- the classloader to use to look for the Component list declaration file (
META-INF/components.txt
)componentDeclarations
- the declarations of components to registerpublic void unregister(ComponentManager manager, ClassLoader classLoader, List<ComponentDeclaration> componentDeclarations)
manager
- the component manager to use to dynamically register componentsclassLoader
- the classloader to use to look for the Component list declaration file (
META-INF/components.txt
)componentDeclarations
- the declarations of components to registerpublic List<ComponentDescriptor<?>> getComponentsDescriptors(Class<?> componentClass)
public Set<Type> findComponentRoleTypes(Class<?> componentClass, Type[] parameters)
@Deprecated public Set<Class<?>> findComponentRoleClasses(Class<?> componentClass)
findComponentRoleTypes(Class)
insteadProvider
(and thus without a component role annotation).componentClass
- the component implementation class for which to find the component roles it implementspublic List<ComponentDeclaration> getDeclaredComponents(ClassLoader classLoader, String location) throws IOException
classLoader
- the classloader to use to find the resourceslocation
- the name of the resources to look forIOException
- in case of an error loading the component list resourcepublic List<ComponentDeclaration> getDeclaredComponents(InputStream componentListStream) throws IOException
(priority level):(fully qualified component implementation name)
.componentListStream
- the stream to parseIOException
- in case of an error loading the component list resourcepublic List<ComponentDeclaration> getDeclaredComponentsFromJAR(InputStream jarFile) throws IOException
jarFile
- the JAR file to parseIOException
- in case of an error loading the component list resourceprotected org.slf4j.Logger getLogger()
Copyright © 2004–2021 XWiki. All rights reserved.