The class uses an event based approach for subclasses to influence the default behavior.
The actual implementation should be enough for most smaller components, as
the class's behavior is widely configurable. You should not override any of
the base class's interface methods if you can avoid it. If you find that an
event handler is missing, please contact the MidCOM development team for
some advice.
Quick start
This class does a lot of things automatically for you, described below. If you
are not interested in the gory details though, here is a quick list of what
you have to know (but don't complain if I have missed anything), and do these
things after calling the base class constructor:
Inherit the class as {$component}_interface (e.g. net_nehmer_static_interface).
Prepare a component manifest for your component, see the class
midcom_core_manifest for details.
You can change the values of all public members, the defaults should be suitable for most cases.
The component's data storage area will contain two keys when the initialized
event handler is called: The NAP active id, defaulting to false and stored
as active_leaf and the component's default configuration, stored as
a midcom_helper_configuration object in the key config.
Put your component-wide default configuration into $component_dir/config/config.inc.
Class parameters
The following options can be used to parametrize the component's startup and operation.
See the individual member documentation for now.
$_nap_class_suffix
$_site_class_suffix
Class operation
This class now does an awful lot of work for you, you just need to configure it
to have the right names and places to look for. It is designed to fit in the
current component wildlife with as little collateral damage as possible, but as
always, a 100% transparent implementation is neither wanted nor sensible.
Actually, you should not need to overwrite any event handler for almost all components
I currently know of. Ultimately, this is a proxy class to the actual component code.
Its main goals are to automate these tasks:
Component startup (loading of the right script files and libraries)
Default configuration (loading of the various configuration files, see the
_load_configuration() method for details)
Component data storage initialization
Context separation during runtime
Example usage
The average component will require something like this, part one is the component
manifest:
Get the full configuration set active for a given topic.
If no topic is passed, the system wide default configuration is returned.
Be aware, that this call does not check if the passed topic is actually handled by
this component, as it is theoretically possible for components to drop configuration
information on other topics as well.
Delegate all watched operations, in two phases. First,
the general _on_watched_operation handler is called, to allow for handling
generic operations. After that, the individual watches are called, to allow
for more specific processing.
This function is triggered at the end of the request for each watched operation
that has been done during the request.
It will be called once per operation and unique object, where object uniqueness
is determined by the combination of object class and guid. The object has been
refreshed before being passed to this event handler.
Parameters
integer
$operation
The operation identifier (one of the MIDCOM_OPERATION constants)
which applies.
This function is triggered at the end of the request for each watched create operation
that has been done during the request.
It will be called once per operation and unique object, where object uniqueness
is determined by the combination of object class and guid. The object has been
refreshed before being passed to this event handler.
It is called after the generic _on_watched_operation event handler.
This function is triggered at the end of the request for each watched update operation
that has been done during the request.
It will be called once per operation and unique object, where object uniqueness
is determined by the combination of object class and guid. The object has been
refreshed before being passed to this event handler.
It is called after the generic _on_watched_operation event handler.
Reindex the given topic. The complete configuration set is already available in
$config. The original index records are already deleted, so you do not need to
bother about this.