Package org.xwiki.component.embed
Class EmbeddableComponentManager
- java.lang.Object
-
- org.xwiki.component.embed.EmbeddableComponentManager
-
- All Implemented Interfaces:
ComponentManager
,NamespacedComponentManager
,Disposable
public class EmbeddableComponentManager extends Object implements NamespacedComponentManager, Disposable
Simple implementation ofComponentManager
to be used when using some XWiki modules standalone.- Since:
- 2.0M1
- Version:
- $Id: f1df13f7d5393acb9a94b5354977d472286e141a $
-
-
Constructor Summary
Constructors Constructor Description EmbeddableComponentManager()
EmbeddableComponentManager(String namespace)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected javax.inject.Provider<?>
createGenericProvider(ComponentDescriptor<?> descriptor, ComponentDependency<?> dependency)
protected Object
createLogger(Class<?> instanceClass)
Create a Logger instance to inject.void
dispose()
<T> ComponentDescriptor<T>
getComponentDescriptor(Type role, String hint)
<T> List<ComponentDescriptor<T>>
getComponentDescriptorList(Class<T> role)
Deprecated.<T> List<ComponentDescriptor<T>>
getComponentDescriptorList(Type role)
ComponentEventManager
getComponentEventManager()
protected <T> T
getComponentInstance(org.xwiki.component.internal.RoleHint<T> roleHint)
Deprecated.usegetInstance(Type, String)
insteadprotected Object
getDependencyInstance(ComponentDescriptor<?> descriptor, Object parentInstance, ComponentDependency<?> dependency)
<T> T
getInstance(Type roleType)
<T> T
getInstance(Type roleType, String roleHint)
<T> List<T>
getInstanceList(Type role)
<T> Map<String,T>
getInstanceMap(Type roleType)
String
getNamespace()
ComponentManager
getParent()
boolean
hasComponent(Type role)
boolean
hasComponent(Type roleType, String roleHint)
void
initialize(ClassLoader classLoader)
Load all component annotations and register them as components.<T> void
registerComponent(ComponentDescriptor<T> componentDescriptor)
<T> void
registerComponent(ComponentDescriptor<T> componentDescriptor, T componentInstance)
void
release(Object component)
void
setComponentEventManager(ComponentEventManager eventManager)
void
setParent(ComponentManager parentComponentManager)
void
unregisterComponent(Type role, String hint)
void
unregisterComponent(ComponentDescriptor<?> componentDescriptor)
-
-
-
Constructor Detail
-
EmbeddableComponentManager
public EmbeddableComponentManager()
-
EmbeddableComponentManager
public EmbeddableComponentManager(String namespace)
- Parameters:
namespace
- the namespace associated with this component manager- Since:
- 6.4M2
-
-
Method Detail
-
getNamespace
public String getNamespace()
- Specified by:
getNamespace
in interfaceNamespacedComponentManager
-
initialize
public void initialize(ClassLoader classLoader)
Load all component annotations and register them as components.- Parameters:
classLoader
- the class loader to use to look for component definitions
-
hasComponent
public boolean hasComponent(Type role)
- Specified by:
hasComponent
in interfaceComponentManager
-
hasComponent
public boolean hasComponent(Type roleType, String roleHint)
- Specified by:
hasComponent
in interfaceComponentManager
-
getInstance
public <T> T getInstance(Type roleType) throws ComponentLookupException
- Specified by:
getInstance
in interfaceComponentManager
- Throws:
ComponentLookupException
-
getInstance
public <T> T getInstance(Type roleType, String roleHint) throws ComponentLookupException
- Specified by:
getInstance
in interfaceComponentManager
- Throws:
ComponentLookupException
-
getInstanceList
public <T> List<T> getInstanceList(Type role) throws ComponentLookupException
- Specified by:
getInstanceList
in interfaceComponentManager
- Throws:
ComponentLookupException
-
getInstanceMap
public <T> Map<String,T> getInstanceMap(Type roleType) throws ComponentLookupException
- Specified by:
getInstanceMap
in interfaceComponentManager
- Throws:
ComponentLookupException
-
getComponentDescriptor
public <T> ComponentDescriptor<T> getComponentDescriptor(Type role, String hint)
- Specified by:
getComponentDescriptor
in interfaceComponentManager
-
getComponentDescriptorList
public <T> List<ComponentDescriptor<T>> getComponentDescriptorList(Type role)
- Specified by:
getComponentDescriptorList
in interfaceComponentManager
-
getComponentEventManager
public ComponentEventManager getComponentEventManager()
- Specified by:
getComponentEventManager
in interfaceComponentManager
-
setComponentEventManager
public void setComponentEventManager(ComponentEventManager eventManager)
- Specified by:
setComponentEventManager
in interfaceComponentManager
-
getParent
public ComponentManager getParent()
- Specified by:
getParent
in interfaceComponentManager
-
setParent
public void setParent(ComponentManager parentComponentManager)
- Specified by:
setParent
in interfaceComponentManager
-
getDependencyInstance
protected Object getDependencyInstance(ComponentDescriptor<?> descriptor, Object parentInstance, ComponentDependency<?> dependency) throws ComponentLookupException
- Throws:
ComponentLookupException
-
createGenericProvider
protected javax.inject.Provider<?> createGenericProvider(ComponentDescriptor<?> descriptor, ComponentDependency<?> dependency)
-
createLogger
protected Object createLogger(Class<?> instanceClass)
Create a Logger instance to inject.
-
getComponentInstance
@Deprecated protected <T> T getComponentInstance(org.xwiki.component.internal.RoleHint<T> roleHint) throws ComponentLookupException
Deprecated.usegetInstance(Type, String)
instead- Throws:
ComponentLookupException
-
registerComponent
public <T> void registerComponent(ComponentDescriptor<T> componentDescriptor) throws ComponentRepositoryException
- Specified by:
registerComponent
in interfaceComponentManager
- Throws:
ComponentRepositoryException
-
registerComponent
public <T> void registerComponent(ComponentDescriptor<T> componentDescriptor, T componentInstance)
- Specified by:
registerComponent
in interfaceComponentManager
-
unregisterComponent
public void unregisterComponent(Type role, String hint)
- Specified by:
unregisterComponent
in interfaceComponentManager
-
unregisterComponent
public void unregisterComponent(ComponentDescriptor<?> componentDescriptor)
- Specified by:
unregisterComponent
in interfaceComponentManager
-
release
public void release(Object component) throws ComponentLifecycleException
- Specified by:
release
in interfaceComponentManager
- Throws:
ComponentLifecycleException
-
dispose
public void dispose()
- Specified by:
dispose
in interfaceDisposable
-
getComponentDescriptorList
@Deprecated public <T> List<ComponentDescriptor<T>> getComponentDescriptorList(Class<T> role)
Deprecated.- Specified by:
getComponentDescriptorList
in interfaceComponentManager
-
-