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 TypeMethodDescriptionvoidaddComponent(IComponent comp) Add a component.voidaddExceptionHandler(ComponentIdentifier cid, Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) voidaddExceptionHandler(Class<?> type, Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) voidaddExceptionHandler(Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) static final ComponentManagerget()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) intGet the number of current components.host()Returns the name of the host on which the Java process is running.booleanAre component ids numbers or strings.voidnotifyEventListener(String type, ComponentIdentifier cid) longpid()Returns the process identifier of the Java process.voidPrint components.voidPrint number of current components.voidRemove a component.voidremoveExceptionHandler(Object key, Class<? extends Exception> clazz) voidsetClassLoader(ClassLoader classloader) Sets the class loader used by components.voidsetComponentIdNumberMode(boolean cidnumbermode) Configure if numbers instead words should be used as automatically generated component names.voidsetDebug(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:
setClassLoaderin 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:
setComponentIdNumberModein interfaceIComponentManager- Parameters:
cidnumbermode- True, if automatically generated names should be numbers.
-
setDebug
public void setDebug(boolean debug) Turns on debug messages globally.- Specified by:
setDebugin 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:
getComponentin interfaceIComponentManager- Throws:
IllegalArgumentException- when the component does not exist.
-
getNumberOfComponents
public int getNumberOfComponents()Get the number of current components.- Specified by:
getNumberOfComponentsin 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:
addExceptionHandlerin interfaceIComponentManager
-
addExceptionHandler
public void addExceptionHandler(Class<?> type, Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) - Specified by:
addExceptionHandlerin interfaceIComponentManager
-
addExceptionHandler
public void addExceptionHandler(Class<? extends Exception> clazz, boolean exactmatch, BiConsumer<? extends Exception, IComponent> handler) - Specified by:
addExceptionHandlerin interfaceIComponentManager
-
removeExceptionHandler
- Specified by:
removeExceptionHandlerin interfaceIComponentManager
-
getExceptionHandler
public <E extends Exception> BiConsumer<? extends Exception,IComponent> getExceptionHandler(E exception, Component component)
-