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
WARNINGS
attribute 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
ERRORS
attribute 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
config
as theACTIVE_CONFIG
attribute.Returns the current active config.
- get_tree
Return
EDG::WP4::CCM::Configuration-``getTree> on the ``ACTIVE_CONFIG
attribute.All arguments are passed to
getTree
.If no arguments are specified, the path passed to
getTree
is the component prefix (using theprefix
method).If the path specified is not absolute, the path passed to
getTree
is prefixed with the component prefix (using theprefix
method).Returns undef on failure, with
fail
attribute 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_app
is used as default when undefined)Optional arguments
- config
Set config as active config (usingset_active_config
method).
Legacy methods¶
- LogMessage
Same aslog
method. This is deprecated, uselog
method instead.
- Report
Same asreport
method. This is deprecated, usereport
method instead.
- Info
Same asinfo
method. This is deprecated, useinfo
method instead.
- Verbose
Same asverbose
method. This is deprecated, useverbose
method instead.
- Debug
Similar to
debug
, but the debug level is set to 1.This is deprecated, use
debug
method instead and set loglevel.
- Warn
Same aswarn
method. This is deprecated, usereport
method instead.
- Error
Same aserror
method. This is deprecated, useerror
method instead.