org.jtheque.core.managers.module
Class ModuleManager

java.lang.Object
  extended by org.jtheque.core.managers.AbstractManager
      extended by org.jtheque.core.managers.module.ModuleManager
All Implemented Interfaces:
IManager, IModuleManager

public final class ModuleManager
extends AbstractManager
implements IModuleManager

A module manager implementation. It manage the cycle life of the modules.

Author:
Baptiste Wicht

Constructor Summary
ModuleManager()
           
 
Method Summary
 void addModuleListener(ModuleListener listener)
          Add a module listener.
 java.lang.String canModuleLaunched(ModuleContainer module)
          Test if a module can ben launched.
 void choosePrimaryModule()
          Choose the primary module to launch.
 void close()
          Close the manager.
 void disableModule(ModuleContainer module)
          Disable a module.
 void enableModule(ModuleContainer module)
          Enable a module.
 ModuleContainer getModule(java.lang.String name)
          Return the module with the name.
 java.util.Collection<ModuleContainer> getModules()
          Return all the modules.
 java.util.List<ModuleDescription> getModulesFromRepository()
          Return all the modules of the application repository.
 ModuleContainer getPrimaryModule()
          Return the current primary module.
 java.util.List<ModuleContainer> getPrimaryModules()
          Return all the primary modules.
 Repository getRepository()
          Return the repository of the application.
 void init()
          Init the manager.
 void install(java.lang.String versionsFileURL)
          Install the module from the versions file.
 boolean installModule(java.io.File file)
          Install a module.
 boolean isCollectionModule()
          Indicate if the primary module is collection based.
 boolean isInstalled(java.lang.String module)
          Test if the module is installed.
 void launchPrimaryModule()
          Launch the primary module.
 void loadModule(ModuleContainer module)
          Load a module.
 boolean plugCollection(java.lang.String collection, java.lang.String password, boolean create)
          Plug the collection.
 void plugModules()
          Plug the modules.
 void preInit()
          Pre-init the manager.
 void prePlugModules()
          Preplug the modules.
 void removeModuleListener(ModuleListener listener)
          Remove a module listener.
 void setPrimaryModule(ModuleContainer primaryModule)
          Set the primary module.
 void switchPrimaryModule()
          Swith the primary module.
 void uninstallModule(ModuleContainer module)
          Uninstall a module.
 void unplugModules()
          Unplug the modules.
 
Methods inherited from class org.jtheque.core.managers.AbstractManager
getErrors, getListeners, getLogger, getMessage, getMessage, getStates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModuleManager

public ModuleManager()
Method Detail

preInit

public void preInit()
Description copied from interface: IManager
Pre-init the manager. This operation is called before modules preplug.

Specified by:
preInit in interface IManager

init

public void init()
Description copied from interface: IManager
Init the manager. This operation is called after modules preplug but before module plug.

Specified by:
init in interface IManager

close

public void close()
Description copied from interface: IManager
Close the manager.

Specified by:
close in interface IManager

prePlugModules

public void prePlugModules()
Preplug the modules.

Specified by:
prePlugModules in interface IModuleManager

plugModules

public void plugModules()
Plug the modules.

Specified by:
plugModules in interface IModuleManager

unplugModules

public void unplugModules()
Unplug the modules.

Specified by:
unplugModules in interface IModuleManager

getModules

public java.util.Collection<ModuleContainer> getModules()
Description copied from interface: IModuleManager
Return all the modules.

Specified by:
getModules in interface IModuleManager
Returns:
All the modules.

getPrimaryModules

public java.util.List<ModuleContainer> getPrimaryModules()
Description copied from interface: IModuleManager
Return all the primary modules.

Specified by:
getPrimaryModules in interface IModuleManager
Returns:
All the primary mmodules.

getModulesFromRepository

public java.util.List<ModuleDescription> getModulesFromRepository()
Description copied from interface: IModuleManager
Return all the modules of the application repository.

Specified by:
getModulesFromRepository in interface IModuleManager
Returns:
all the modules of the application repository.

getRepository

public Repository getRepository()
Description copied from interface: IModuleManager
Return the repository of the application.

Specified by:
getRepository in interface IModuleManager
Returns:
The Repository.

setPrimaryModule

public void setPrimaryModule(ModuleContainer primaryModule)
Set the primary module.

Specified by:
setPrimaryModule in interface IModuleManager
Parameters:
primaryModule - The primary module.

getPrimaryModule

public ModuleContainer getPrimaryModule()
Description copied from interface: IModuleManager
Return the current primary module.

Specified by:
getPrimaryModule in interface IModuleManager
Returns:
The primary module.

loadModule

public void loadModule(ModuleContainer module)
Load a module.

Specified by:
loadModule in interface IModuleManager
Parameters:
module - The module to load.

enableModule

public void enableModule(ModuleContainer module)
Description copied from interface: IModuleManager
Enable a module.

Specified by:
enableModule in interface IModuleManager
Parameters:
module - The module to enable.

disableModule

public void disableModule(ModuleContainer module)
Disable a module.

Specified by:
disableModule in interface IModuleManager
Parameters:
module - The module to disable.

installModule

public boolean installModule(java.io.File file)
Install a module.

Specified by:
installModule in interface IModuleManager
Parameters:
file - The file of the module.
Returns:
true if the module has been installed, else false.

install

public void install(java.lang.String versionsFileURL)
Description copied from interface: IModuleManager
Install the module from the versions file.

Specified by:
install in interface IModuleManager
Parameters:
versionsFileURL - The URL of the versions file.

choosePrimaryModule

public void choosePrimaryModule()
Description copied from interface: IModuleManager
Choose the primary module to launch.

Specified by:
choosePrimaryModule in interface IModuleManager

uninstallModule

public void uninstallModule(ModuleContainer module)
Uninstall a module.

Specified by:
uninstallModule in interface IModuleManager
Parameters:
module - The module to uninstall.

addModuleListener

public void addModuleListener(ModuleListener listener)
Description copied from interface: IModuleManager
Add a module listener.

Specified by:
addModuleListener in interface IModuleManager
Parameters:
listener - The listener to add.

removeModuleListener

public void removeModuleListener(ModuleListener listener)
Description copied from interface: IModuleManager
Remove a module listener.

Specified by:
removeModuleListener in interface IModuleManager
Parameters:
listener - The listener to remove.

canModuleLaunched

public java.lang.String canModuleLaunched(ModuleContainer module)
Description copied from interface: IModuleManager
Test if a module can ben launched.

Specified by:
canModuleLaunched in interface IModuleManager
Parameters:
module - The module to be launched.
Returns:
The error message. If the error is empty, the module can be launched.

getModule

public ModuleContainer getModule(java.lang.String name)
Description copied from interface: IModuleManager
Return the module with the name.

Specified by:
getModule in interface IModuleManager
Parameters:
name - The name of the module.
Returns:
The module.

isInstalled

public boolean isInstalled(java.lang.String module)
Description copied from interface: IModuleManager
Test if the module is installed.

Specified by:
isInstalled in interface IModuleManager
Parameters:
module - The module name.
Returns:
true if the module is installed.

launchPrimaryModule

public void launchPrimaryModule()
Launch the primary module.

Specified by:
launchPrimaryModule in interface IModuleManager

switchPrimaryModule

public void switchPrimaryModule()
Swith the primary module.

Specified by:
switchPrimaryModule in interface IModuleManager

isCollectionModule

public boolean isCollectionModule()
Description copied from interface: IModuleManager
Indicate if the primary module is collection based.

Specified by:
isCollectionModule in interface IModuleManager
Returns:
true if the primary module is collection based else false.

plugCollection

public boolean plugCollection(java.lang.String collection,
                              java.lang.String password,
                              boolean create)
Description copied from interface: IModuleManager
Plug the collection.

Specified by:
plugCollection in interface IModuleManager
Parameters:
collection - The collection to use.
password - The password of the collection.
create - A boolea flag indicating if we must create the collection or not.
Returns:
true if the process has been correctly effectued else false.


Copyright © 2009 JTheque. All Rights Reserved.