Package jadex.core.impl
Class ComponentManager
java.lang.Object
jadex.core.impl.ComponentManager
- All Implemented Interfaces:
IComponentManager
Singleton class providing general information for supporting components.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Map
<ComponentIdentifier, IComponent> The components.protected Map
<Object, Map<Object, ComponentManager.HandlerInfo>> The exception handlers.final Map
<String, Set<IComponentListener>> The component listeners. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponent
(IComponent comp) Add a component.void
addExceptionHandler
(ComponentIdentifier cid, Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) void
addExceptionHandler
(Class<?> type, Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) void
addExceptionHandler
(Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) static final ComponentManager
get()
Returns the component manager instance.Gets the class loader used by components.Get a running component.<E extends Exception>
BiConsumer<? extends Exception, IComponent> getExceptionHandler
(E exception, Component component) int
Get the number of current components.host()
Returns the name of the host on which the Java process is running.boolean
Are component ids numbers or strings.void
notifyEventListener
(String type, ComponentIdentifier cid) long
pid()
Returns the process identifier of the Java process.void
Print components.void
Print number of current components.void
Remove a component.void
removeExceptionHandler
(Object key, Class<? extends Exception> clazz) void
setClassLoader
(ClassLoader classloader) Sets the class loader used by components.void
setComponentIdNumberMode
(boolean cidnumbermode) Configure if numbers instead words should be used as automatically generated component names.void
setDebug
(boolean debug) Turns on debug messages globally.
-
Field Details
-
listeners
The component listeners. -
components
The components. -
exceptionhandlers
The exception handlers.
-
-
Method Details
-
get
Returns the component manager instance.- Returns:
- The component manager instance.
-
pid
public long pid()Returns the process identifier of the Java process.- Returns:
- Process identifier of the Java process.
-
host
Returns the name of the host on which the Java process is running.- Returns:
- Name of the host on which the Java process is running.
-
setClassLoader
Sets the class loader used by components.- Specified by:
setClassLoader
in interfaceIComponentManager
- Parameters:
classloader
- The class loader that components should use.
-
getClassLoader
Gets the class loader used by components.- Returns:
- The class loader that components should use.
-
isComponentIdNumberMode
public boolean isComponentIdNumberMode()Are component ids numbers or strings.- Returns:
- True, if number mode.
-
setComponentIdNumberMode
public void setComponentIdNumberMode(boolean cidnumbermode) Configure if numbers instead words should be used as automatically generated component names.- Specified by:
setComponentIdNumberMode
in interfaceIComponentManager
- Parameters:
cidnumbermode
- True, if automatically generated names should be numbers.
-
setDebug
public void setDebug(boolean debug) Turns on debug messages globally.- Specified by:
setDebug
in interfaceIComponentManager
- Parameters:
debug
- If true, debug messages are emitted globally.
-
addComponent
Add a component.- Parameters:
comp
- The component.
-
removeComponent
Remove a component.- Parameters:
cid
- The component id.
-
getComponent
Get a running component.- Specified by:
getComponent
in interfaceIComponentManager
- Throws:
IllegalArgumentException
- when the component does not exist.
-
getNumberOfComponents
public int getNumberOfComponents()Get the number of current components.- Specified by:
getNumberOfComponents
in interfaceIComponentManager
-
printNumberOfComponents
public void printNumberOfComponents()Print number of current components. -
printComponents
public void printComponents()Print components. -
notifyEventListener
-
addExceptionHandler
public void addExceptionHandler(ComponentIdentifier cid, Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) - Specified by:
addExceptionHandler
in interfaceIComponentManager
-
addExceptionHandler
public void addExceptionHandler(Class<?> type, Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) - Specified by:
addExceptionHandler
in interfaceIComponentManager
-
addExceptionHandler
public void addExceptionHandler(Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) - Specified by:
addExceptionHandler
in interfaceIComponentManager
-
removeExceptionHandler
- Specified by:
removeExceptionHandler
in interfaceIComponentManager
-
getExceptionHandler
public <E extends Exception> BiConsumer<? extends Exception,IComponent> getExceptionHandler(E exception, Component component)
-