NCM::Component¶
NAME¶
NCM::Component - basic support functions for NCM components
INHERITANCE¶
CAF::Object
DESCRIPTION¶
This class provides the neccessary support functions for components, which have to inherit from it.
Public methods¶
- warn
Report with loglevel ‘WARN’. Increases the number of reported warnings in the
WARNINGSattribute by 1.(The ncd client will report the number of warnings reported by the component.)
- error
Report with loglevel ‘ERROR’. Increases the number of reported errors in the
ERRORSattribute by 1.(The ncd client will report the number of errors reported by the component. The component will therefore be flagged as failed, and no depending components will be executed.)
- name
Returns the component name
- prefix
Returns the standard configuration path for the component</software/components/<name>>.
- get_warnings(): integer
Returns the number of calls to ‘warn’ by the component.
- get_errors(): integer
Returns the number of calls to ‘error’ by the component.
- event
Add an event to the history (if exists). Following metadata is added
- component
The component name
- component_module
The component moduleAll other arguments are passed on unmodified.
- event_report
Report any relevant events:
- events triggered by this component
- modified files
Returns arrayref with reported event indices.
- set_active_config
Set
configas theACTIVE_CONFIGattribute.Returns the current active config.
- get_tree
Return
EDG::WP4::CCM::Configuration-``getTree> on the ``ACTIVE_CONFIGattribute.All arguments are passed to
getTree.If no arguments are specified, the path passed to
getTreeis the component prefix (using theprefixmethod).If the path specified is not absolute, the path passed to
getTreeis prefixed with the component prefix (using theprefixmethod).Returns undef on failure, with
failattribute set in case of an error.(Requires active configuration set).
- get_fqdn
Return the fqdn based on the current active config.
This is either
/system/network/realhostname(if defined) or</system/network/hostname>.</system/network/domainname>.(Requires active configuration set).
Pure virtual methods¶
- Configure($config): boolean
Component Configure method. Has to be overwritten if used.
- Unconfigure($config): boolean
Component Unconfigure method. Has to be overwritten if used.
Private methods¶
- _initialize
object initialization (done via new)
Arguments
- name
Set the component name
- logger
Set the logger instance (main::this_appis used as default when undefined)Optional arguments
- config
Set config as active config (usingset_active_configmethod).
Legacy methods¶
- LogMessage
Same aslogmethod. This is deprecated, uselogmethod instead.
- Report
Same asreportmethod. This is deprecated, usereportmethod instead.
- Info
Same asinfomethod. This is deprecated, useinfomethod instead.
- Verbose
Same asverbosemethod. This is deprecated, useverbosemethod instead.
- Debug
Similar to
debug, but the debug level is set to 1.This is deprecated, use
debugmethod instead and set loglevel.
- Warn
Same aswarnmethod. This is deprecated, usereportmethod instead.
- Error
Same aserrormethod. This is deprecated, useerrormethod instead.