Class midcom_helper__componentloader

Description

This class is a Factory that is responsible for loading and establishing the interface to a MidCOM Component.

When the component loader receives a request it roughly works in three stages:

  1. Verify that the given component is valid in terms of the MidCOM Specification. This will check the existence of all required SnippetDirs.
  2. Load all Snippets related with the MidCOM Interface Concept Classes and instantiate the Midcom and Component concept classes, initialize the Component. Check whether all required concept classes exist.
  3. Return the various interface concepts upon each request from the framework.
Stage 1 will do all basic sanity checking possible before loading any snippets. It will check for the existence of all defined sub-SnippetDirs that are required for the system to work. If anything is missing, step 1 fails and the componentloader refuses to load the component.

Stage 2 will then load the interfaces.php file from the midcom directory. The existence of all required Interface classes is then checked. If this check is successful, the concrete classes of the various interface concepts are instantiated and stored internally. The component is initialized by the call to MIDCOM::initialize() which should load everything necessary.

Stage 3 is the final stage where the loader stays in memory in order to return references (!) to the loaded component's Interface Classes upon request.

In case you need an instance of the component loader to verify or transform component paths, use the function midcom_application::get_component_loader, which returns a reference to the loader.

Located in /midcom/helper/_componentloader.php (line 52)


	
			
Variable Summary
Method Summary
 midcom_helper__componentloader midcom_helper__componentloader ()
 mixed &get_component_class (string $path)
 mixed get_component_property (string $path, int $key)
 mixed &get_contentadmin_class (string $path)
 mixed &get_midcom_class (string $path)
 mixed &get_nap_class (string $path)
 bool is_loaded (string $path)
 void load (string $path)
 void load_all ()
 string path_to_prefix (string $path)
 string path_to_snippetpath (string $path)
 string snippetpath_to_prefix (string $snippetpath)
 void _load (string $path)
 void _load_all_dir (string $path, string $prefix)
 bool _validate_path (string $snippetpath)
 bool _validate_url (string $path)
Variables
Array $_component_classes (line 71)

This is a part of the component cache. It stores references to the COMPONENT classes of the different loaded components, indexed by their MidCOM Path.

  • access: private
Array $_component_properties (line 90)

This is a part of the component cache. It stores the properties of the already loaded components.

  • access: private
Array $_contentadmin_classes (line 81)

This is a part of the component cache. It stores references to the Content Administration variant of the COMPONENT classes of the different loaded components, indexed by their MidCOM Path.

  • access: private
Array $_interface_classes (line 101)

This is a part of the component cache. It stores references to the interface classes of the different loaded components, indexed by their MidCOM Path.

Array $_loaded (line 61)

This indexed array stores the MidCOM paths of all loaded components. Its elements are used as keys for the cache storage.

  • access: private
Array $_midcom_classes (line 112)

This is a part of the component cache. It stores references to the MIDCOM classes of the different loaded component, indexed by their MidCOM Path.

  • deprecated: This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.
  • access: private
Array $_nap_classes (line 134)

This is a part of the component cache. It stores references to the NAP classes of the different loaded component, indexed by their MidCOM Path.

  • deprecated: This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.
  • access: private
Array $_output_classes (line 123)

This is a part of the component cache. It stores references to the OUTPUT classes of the different loaded component, indexed by their MidCOM Path.

  • deprecated: This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.
  • access: private
Methods
Constructor midcom_helper__componentloader (line 140)

The constructor will initialize the class. Nothing special is done here.

midcom_helper__componentloader midcom_helper__componentloader ()
get_component_class (line 369)

Returns a reference to an instance of the specified component's

COMPONENT class. The component is given in $path as a MidCOM path. Such an instance will be cached by the framework so that only one instance is always active for each component. Missing components will be dynamically loaded into memory.

  • return: A reference to the concept class in question.
  • deprecated: This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.
mixed &get_component_class (string $path)
  • string $path: The component name.
get_component_property (line 537)

Returns a property value for the component identified by the

MidCOM Path $path and the property key $key. It will return NULL if the property key is unknown. Remeber to make a type sensitive comparison here. If the component is not loaded, the framework tries to load it, see _componentloader::load for further details.

  • return: A reference to the concept class in question.
mixed get_component_property (string $path, int $key)
  • string $path: The component name.
  • int $key: The property being queried.
get_contentadmin_class (line 423)

Returns a reference to an instance of the specified component's

Content Admin COMPONENT class. The component is given in $path as a MidCOM path. Such an instance will be cached by the framework so that only one instance is always active for each component. Missing components will be dynamically loaded into memory.

  • return: A reference to the concept class in question.
  • deprecated: This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.
mixed &get_contentadmin_class (string $path)
  • string $path: The component name.
get_interface_class (line 344)

Returns a reference to an instance of the specified component's interface class. The component is given in $path as a MidCOM path.

Such an instance will be cached by the framework so that only one instance is always active for each component. Missing components will be dynamically loaded into memory.

  • return: A reference to the concept class in question or NULL if the class in question does not yet support the new Interface system.
midcom_baseclasses_components_interface &get_interface_class (string $path)
  • string $path: The component name.
get_midcom_class (line 320)

Returns a reference to an instance of the specified component's MIDCOM class. The component is given in $path as a MidCOM path.

Such an instance will be cached by the framework so that only one instance is always active for each component. Missing components will be dynamically loaded into memory.

  • return: A reference to the concept class in question.
  • deprecated: This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.
mixed &get_midcom_class (string $path)
  • string $path: The component name.
get_nap_class (line 484)

Returns a reference to an instance of the specified component's

NAP class. The component is given in $path as a MidCOM path. Such an instance will be cached by the framework so that only one instance is always active for each component. Missing components will be dynamically loaded into memory.

  • return: A reference to the concept class in question.
  • deprecated: This has been deprecated in MidCOM 2.4 in favor of the new component interface classes.
mixed &get_nap_class (string $path)
  • string $path: The component name.
is_loaded (line 304)

Returns TRUE if the component identified by the MidCOM path $url is already loaded and available for usage.

  • return: true if it is loaded, false otherwise.
bool is_loaded (string $path)
  • string $path: The component to be queried.
list_loaded_components (line 671)

Retrieve a list of all loaded components. The Array will contain an unsortet collection of MidCOM Paths.

  • return: List of loaded components
Array list_loaded_components ()
load (line 156)

This function will invoke _load directly. If the loading process is unsucessful, it will call generate_error.

void load (string $path)
  • string $path: The component to load explicitly.
load_all (line 688)

This function tries to load all available components by traversing

the complete(!) Snippetdir Tree. Note, that this might take some time, so use it carefully. After this function returns you can get a list of all available and valid component paths' through list_loaded_components. It will only query the root snippetdirs matching the known top-level-domains (two-letter ones, com, net, org, name, biz, museum). This is done to speed up processing as Asgard or Nemein.Net for example clutter the SG0 with lots of snippetdirs that are no MidCOM components. Note that the load_all command also iterates through the MidCOM tree.

void load_all ()
path_to_prefix (line 590)

Helper, converting a component path (de.linkm.newsticker) to a class prefix (de_linkm_newsticker).

  • return: Converted string.
string path_to_prefix (string $path)
  • string $path: Input string.
path_to_snippetpath (line 566)

Helper, converting a component path (de.linkm.newsticker) to a snippetpath (/de/linkm/newsticker).

  • return: Converted string.
string path_to_snippetpath (string $path)
  • string $path: Input string.
snippetpath_to_prefix (line 578)

Helper, converting a snippetpath (/de/linkm/newsticker) to a class prefix (de_linkm_newsticker).

  • return: Converted string.
string snippetpath_to_prefix (string $snippetpath)
  • string $snippetpath: Input string.
_load (line 170)

This function will load the component specified by the MidCOM path $path. If the component could not be loaded successfully due to integrity errors (missing SnippetDirs, Classes, etc.), it will return false and populate $midcom_errstr accordingly.

  • access: private
void _load (string $path)
  • string $path: The component to load.
_load_all_dir (line 731)

This function is a helper of load_all. It iterates through the available

subdirs of the directory $path. It ignores the known MidCOM subdirs like "style". for all others it first tries to load them as a component, and then invokes _load_all_dir again for that dir to cover the subdirs. It stops if no snippetdirs are left. The string $prefix is the MidCOM Path prefix for the snippetdir $id.

void _load_all_dir (string $path, string $prefix)
  • string $path: Current Path to search.
  • string $prefix: Current component prefix for the search.
_validate_path (line 605)

_validate_path is used to validate the component located at the snippetdir Path $snippetpath. This is a fully qualified snippetdir path to the component in question.

  • return: True if valid, false otherwise.
  • access: private
  • todo: Currently partly disabled due to the FS-Transition.
bool _validate_path (string $snippetpath)
  • string $snippetpath: The path to be checked.
_validate_url (line 649)

Will validate the given MidCOM Path $path for syntactical

correctness. Currently this is a RegEx check that checks for invalid characters in $path, so _validate_url does explicitly not check whether the referenced component does exist and whether it is structurally valid.

  • return: True if valid, false otherwise.
  • access: private
bool _validate_url (string $path)
  • string $path: The path to be checked.

Documentation generated on Mon, 21 Nov 2005 18:25:42 +0100 by phpDocumentor 1.3.0RC3