Class ModuleDB

Description

Implements interfaces:

The Module Manager

The module manager is one of the core features of phpSATk. Our module management features multiple module (called Overlays here ModuleOverlay) repositories. E.g. there may be a global overlay which provides basic modules, a per-user/per-host overlay for user-installed modules and another overlay per application. Depencies are supported as well as so called virtual-modules, that means modules providing the same functionality (e.g. different authentication backends).

For performance reasons the various common attributes are indexed using ModuleIndexer, so dont use findModule() and findModules() whenever possible.

Only one instance is legal so this class is implemented using a singleton pattern. Also an iterator is available, allowing you to easily traverse the different overlays. Internally the overlays are stored in a linked list. Error handling is done using ModuleException exceptions.

Located in /phpsatk-lib/core/15.module.db.php (line 49)


	
			
Variable Summary
Method Summary
ModuleDB __construct ()
void addOverlay (ModuleOverlay $newOverlay)
void bindVirtual (string $virtual, int $version, string $module)
ModuleItem findClass (string $class)
ModuleItem findModule (ModuleSearch $search, [boolean $strict = true])
ModuleList findModules (ModuleSearch $search)
ModuleItem getModule (string $id)
ModuleClass getVirtualClass (string $virtual, int $version)
ModuleItem getVirtualModule (string $virtual, int $version)
ModuleList getVirtualModules (string $virtual, int $version)
string key ()
void next ()
void rewind ()
boolean valid ()
Variables
ModuleDB $instance = null (line 56)

Singleton instance storage

  • static:
Methods
Constructor __construct (line 75)

Initializes the ModuleDB

This function is protected to prevent users from instanciating another ModuleDB

  • access: protected
ModuleDB __construct ()
addOverlay (line 133)

Adds a overlay to the list

  1. ModuleDB::getInstance()->addOverlay(new ModuleOverlay('/some/path'));

void addOverlay (ModuleOverlay $newOverlay)
bindVirtual (line 213)

This function binds a real module to a virtual

This function is internally used by the configuration component.

If a user wants to use for example a specific authentication backend he is able to because he can bind e.g. a module named 'org.eenterphace.sat.auth.rdbms' to the virtual role 'auth.backend'.

  • access: public
void bindVirtual (string $virtual, int $version, string $module)
  • string $virtual: Virtual role to bind to
  • int $version: Virtual version
  • string $module: Module-ID
current (line 334)

Gets the overlay the iterator points to

  • access: public
ModuleOverlay current ()
findClass (line 186)

Finds the module containting a specified class.

  1. // If the class 'foo' was contained in a module called 'bar'
  2. $module = ModuleDB::getInstance()->findClass('foo');
  3. // will return a ModuleItem for the module 'bar'

  • access: public
ModuleItem findClass (string $class)
  • string $class: Class name
findModule (line 154)

Finds the first matching module in all overlays

Overlays are searched through in the order of adding them.

ModuleItem findModule (ModuleSearch $search, [boolean $strict = true])
  • ModuleSearch $search: Search conditions
  • boolean $strict: Whether to throw an Exception if no module was found.
findModules (line 170)

Finds all modules matching the search condition

  • access: public
ModuleList findModules (ModuleSearch $search)
getIndexer (line 116)

Gets the Module indexer

  • access: public
ModuleIndexer getIndexer ()
getInstance (line 63)

Returns the global ModuleDB instance

  • access: public
  • static:
ModuleDB getInstance ()
getModule (line 281)

Gets a module based on its ID

  • access: public
ModuleItem getModule (string $id)
  • string $id: Module ID
getVirtualClass (line 261)

Directly gets the first matching class for a given role

  • access: public
ModuleClass getVirtualClass (string $virtual, int $version)
  • string $virtual: Virtual role
  • int $version: Version
getVirtualModule (line 234)

Directly gets the first matching module for a given role

  • access: public
ModuleItem getVirtualModule (string $virtual, int $version)
  • string $virtual: Virtual role
  • int $version: Version
getVirtualModules (line 250)

Directly gets all matching module for a given role

  • access: public
ModuleList getVirtualModules (string $virtual, int $version)
  • string $virtual: Virtual role
  • int $version: Version
key (line 325)

Gets the key of the overlay the iterator is pointing to

In this case the path to the overlay is returned.

  1. foreach(ModuleDB::getInstance() as $path => $overlay) {
  2. echo "Found Overlay at $path\n";
  3. }

  • access: public
string key ()
next (line 308)

Moves the iterator pointer to the next overlay

  • access: public
void next ()
rewind (line 301)

Rewinds the iterator pointer to the first added overlay

  • access: public
void rewind ()
valid (line 346)

Iterator function

This function is interally used by PHP to determine when the iterator is at the end.

  • access: public
boolean valid ()

Documentation generated on Mon, 21 May 2007 10:34:36 +0200 by phpDocumentor 1.3.0RC5