Package eu.cloudnetservice.driver.module
Class DefaultModuleProviderHandler
java.lang.Object
eu.cloudnetservice.driver.module.DefaultModuleProviderHandler
- All Implemented Interfaces:
ModuleProviderHandler
@Singleton
public class DefaultModuleProviderHandler
extends Object
implements ModuleProviderHandler
Represents the default implementation of the module provider handler.
- Since:
- 4.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final EventManagerprivate static final eu.cloudnetservice.common.log.Loggerprotected final ModuleProviderprotected final ServiceRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultModuleProviderHandler(@NonNull EventManager eventManager, @NonNull ModuleProvider moduleProvider, @NonNull ServiceRegistry serviceRegistry) -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends Event>
TcallEvent(T event) Shortcut for calling an event usingEventManager.callEvent(Event)voidhandlePostInstallDependency(@NonNull ModuleConfiguration configuration, @NonNull ModuleDependency dependency) Called when a dependency for a module was loaded.voidhandlePostModuleLoad(@NonNull ModuleWrapper moduleWrapper) Called when a module was loaded.voidhandlePostModuleReload(@NonNull ModuleWrapper moduleWrapper) Called when a module was reloaded.voidhandlePostModuleStart(@NonNull ModuleWrapper moduleWrapper) Called when a module was started.voidhandlePostModuleStop(@NonNull ModuleWrapper moduleWrapper) Called when a module was stopped.voidhandlePostModuleUnload(@NonNull ModuleWrapper moduleWrapper) Called when a module was unloaded.voidhandlePreInstallDependency(@NonNull ModuleConfiguration configuration, @NonNull ModuleDependency dependency) Called when a dependency for a module is about to get loaded.booleanhandlePreModuleLoad(@NonNull ModuleWrapper moduleWrapper) Called when a module is about to get loaded.booleanhandlePreModuleReload(@NonNull ModuleWrapper moduleWrapper) Called when a module is about to get reloaded.booleanhandlePreModuleStart(@NonNull ModuleWrapper moduleWrapper) Called when a module is about to get started.booleanhandlePreModuleStop(@NonNull ModuleWrapper moduleWrapper) Called when a module is about to get stopped.voidhandlePreModuleUnload(@NonNull ModuleWrapper moduleWrapper) Called when a module is about to get unloaded.protected Object[]moduleArguments(@NonNull ModuleConfiguration configuration) Creates a new object array with these properties of the module: group name version
-
Field Details
-
LOGGER
private static final eu.cloudnetservice.common.log.Logger LOGGER -
eventManager
-
moduleProvider
-
serviceRegistry
-
-
Constructor Details
-
DefaultModuleProviderHandler
@Inject protected DefaultModuleProviderHandler(@NonNull @NonNull EventManager eventManager, @NonNull @NonNull ModuleProvider moduleProvider, @NonNull @NonNull ServiceRegistry serviceRegistry)
-
-
Method Details
-
handlePreModuleLoad
Called when a module is about to get loaded.- Specified by:
handlePreModuleLoadin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module wrapper which will be loaded.- Returns:
- if the module is allowed to load.
-
handlePostModuleLoad
Called when a module was loaded.- Specified by:
handlePostModuleLoadin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which was loaded.
-
handlePreModuleStart
Called when a module is about to get started.- Specified by:
handlePreModuleStartin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which will be started.- Returns:
- if the module is allowed to start.
-
handlePostModuleStart
Called when a module was started.- Specified by:
handlePostModuleStartin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which was started.
-
handlePreModuleReload
Called when a module is about to get reloaded.- Specified by:
handlePreModuleReloadin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which will be reloaded.- Returns:
- if the module is allowed to be reloaded.
-
handlePostModuleReload
Called when a module was reloaded.- Specified by:
handlePostModuleReloadin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which was reloaded.
-
handlePreModuleStop
Called when a module is about to get stopped.- Specified by:
handlePreModuleStopin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which will be stopped.- Returns:
- if the module is allowed to stop.
-
handlePostModuleStop
Called when a module was stopped.- Specified by:
handlePostModuleStopin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which was stopped.
-
handlePreModuleUnload
Called when a module is about to get unloaded.- Specified by:
handlePreModuleUnloadin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which will be unloaded.
-
handlePostModuleUnload
Called when a module was unloaded.- Specified by:
handlePostModuleUnloadin interfaceModuleProviderHandler- Parameters:
moduleWrapper- the module which was unloaded.
-
handlePreInstallDependency
public void handlePreInstallDependency(@NonNull @NonNull ModuleConfiguration configuration, @NonNull @NonNull ModuleDependency dependency) Called when a dependency for a module is about to get loaded.- Specified by:
handlePreInstallDependencyin interfaceModuleProviderHandler- Parameters:
configuration- the configuration of the module in which the dependency is declared.dependency- the dependency which will be loaded.
-
handlePostInstallDependency
public void handlePostInstallDependency(@NonNull @NonNull ModuleConfiguration configuration, @NonNull @NonNull ModuleDependency dependency) Called when a dependency for a module was loaded.- Specified by:
handlePostInstallDependencyin interfaceModuleProviderHandler- Parameters:
configuration- the configuration of the module in which the dependency is declared.dependency- the dependency which was loaded.
-
callEvent
Shortcut for calling an event usingEventManager.callEvent(Event)- Type Parameters:
T- the method parameter of the event- Parameters:
event- the event to call.- Returns:
- the same given event instance.
- Throws:
NullPointerException- if event is null.
-
moduleArguments
Creates a new object array with these properties of the module:- group
- name
- version
- Parameters:
configuration- the module configuration to obtain the information from.- Returns:
- an object array containing the group, name and version of the module.
- Throws:
NullPointerException- if configuration is null.
-