Package com.chillycheesy.modulo.modules
Class ModuleLoader
java.lang.Object
com.chillycheesy.modulo.modules.ModuleLoader
Class that build and load all the
Module in the modules folder.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet a list of loadedModule.Get a list of startedModule.booleanCheck if a file is in the good format
seeModuleBuilderfor details.booleanCheck if a jar file is in the good format
seeModuleBuilderfor details.booleanCheck if a jar file is in the good format
seeModuleBuilderfor details.loadModule(Module module)Load a module already built
It will call the load method of the module.loadModule(File file)Load a module.loadModule(File file, URLClassLoader urlClassLoader)Load a module.voidloadModule(String filepath)Load a module from a jar file pathloadModules(File file)Load jar inside a folder if the jar was a module.loadModules(String filepath)Method call to load the jar files in a folder path.voidstartModule(Module module)voidPut and start all loaded modules in theModuleManager.voidstartModules(List<Module> modules)
-
Constructor Details
-
ModuleLoader
public ModuleLoader()Crate a new ModuleLoader.
-
-
Method Details
-
loadModules
Load jar inside a folder if the jar was a module. It will call the load method of the module.- Parameters:
file- folder to load.- Throws:
FileIsNotAModuleDirectoryException- If the target path was not a module directory.IOException- If the file was not a JarFile.
-
loadModules
public List<Module> loadModules(String filepath) throws FileIsNotAModuleDirectoryException, IOExceptionMethod call to load the jar files in a folder path. It will call the load method of the module.- Parameters:
filepath- path of the folder file.- Throws:
FileIsNotAModuleDirectoryException- If the target path was not a module directory.IOException- If the file was not a JarFile.
-
loadModule
Load a module already built
It will call the load method of the module.- Parameters:
module- The module you want to load.
-
loadModule
Load a module.- Parameters:
file- The jar file. It should be a module.- Throws:
IOException- If the file was not a JarFile.
-
loadModule
Load a module.- Parameters:
file- The jar file. It should be a module.urlClassLoader- The used classLoader.- Throws:
IOException- If the file was not a JarFile.
-
startModules
Put and start all loaded modules in theModuleManager. -
startModules
-
startModule
-
loadModule
Load a module from a jar file path- Parameters:
filepath- jar file path you want to load- Throws:
IOException- If the file was not a JarFile.
-
isValid
Check if a jar file is in the good format
seeModuleBuilderfor details.- Parameters:
file- Jar file you want to check.- Returns:
- True if it's valid, false if it isn't.
-
isValid
Check if a file is in the good format
seeModuleBuilderfor details.- Parameters:
file- File you want to check- Returns:
- True if it's valid, false if it isn't
- Throws:
IOException- If the file was not a JarFile.
-
isValid
Check if a jar file is in the good format
seeModuleBuilderfor details.- Parameters:
filepath- jar file path you want to check- Returns:
- true if it's valid, false if it isn't
- Throws:
IOException- If the file was not a JarFile.
-
getLoadedModules
Get a list of loadedModule.- Returns:
- The loaded
Modulelist.
-
getStartedModule
Get a list of startedModule.- Returns:
- The started
Modulelist.
-