Skip to content

API: Module Management

TheCrownedFox edited this page Jun 13, 2013 · 11 revisions

General Overview

This section details the interaction between Modules and the Module Manager. This relationship provides a way for Modules to request the next Module they would like loaded. This is especially significant in the case of a home screen or launcher Module where this is their main duty. Also provided is a way for Modules to request information about themselves and other Modules they have access to. This information contains things like Author name and target Interface SDK version. For a full listing of relevant information please see the ModuleMetaData class.

A Module is not guaranteed to be able to get this information or set the next Module. The Module Manager determines a Module's permissions to do so from a Module's manifest file. Please visit this page for more detailed information about the Module Manifest.

One other important note to take is that a Module should not be talking directly to the ModuleManager. Modules do not need to call the functions shown in the API Overview through an object, rather the methods are provided through their parent module class.

API Overview

Working with Modules & Their MetaData

public final boolean setNextModuleToLoad(String moduleName)

This function will set the next Module to run provided:

  1. the Module exists and has its dependencies met (both other modules and input types)

  2. your current module has an optional or required dependency on that module or you have every module as optional (again check this page on how to do that)

If the module cannot be set as the next module, false will be returned. Otherwise, true.


public ModuleMetaData getModuleMetaData(String packageName)

Provides the ModuleMetaData for a given module, specified by it's package name.


public String[] getAllAvailableModules()

Provides a String array of all the modules' package names. Subsequent calls to getModuleMetaData given entries in the array will provide the meta data.

Loading Internal Resources

Since Modules are are packaged into JARs, the resources internal to the JAR will be unavailable without ensuring that the classloader is correct. Therefore, methods are provided to access resources from within the JAR.

public InputStream loadResourceFromModule(String jarResourcePath,
			ModuleMetaData m)

Loads a resource given a path within the JAR directory for a given module indicated by it's ModuleMetaData.


public InputStream loadResourceFromModule(String jarResourcePath)

Loads a resource within the currently running module's JAR.

Clone this wiki locally