Tags

internal package Foswiki::Configure::Checker

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package Foswiki::Configure::Checker;

Base class of all checkers. Checkers give checking and guessing support for configuration values. Checkers are designed to be totally independent of UI.

All 'Value' type configuration items in the model can have a checker. Further, if a value doesn't have an individual checker, there may be an associated type checker. If an item has an individual checker, it's type checker is not invoked.

A checker must provide check_current_value, as described below.

Checkers never modify $Foswiki::cfg.

Checker objects are not instantiated directly. Rather, they are generated using the loadChecker factory method described below.

StaticMethod loadChecker($item [, $explicit]) → $checker

Loads the Foswiki::Configure::Checker subclass for the given $item. For example, given the $item->{keys} '{Beans}{Mung}', it will try and load Foswiki::Configure::Checkers::Beans::Mung

An item may specify a different checker to load if it has the CHECKER attribute. This will be interpreted as keys for the 'real' checker to lead for this item. This behaviour is suppressed if $explicit is true (i.e. CHECKER will be ignored, and the default behaviour will apply. This is useful in the case where an explicit CHECKER has to chain the other checkers for an item.)

If the item doesn't have a subclass defined, the item's type class may define a generic checker for that type. If so, it is instantiated for this item.

Finally, we will see if $item's type, or one it inherits from has a generic checker. If so, that's instantiated.

Returns the checker that's created or undef if no such checker is found.

Will die if the checker exists but fails to compile.

$item is passed on to the checker's constructor.

ObjectMethod check_current_value($reporter)

* $reporter - report logger; use ERROR, WARN etc on this object to record information.

The value to be checked is taken from $Foswiki::cfg. This is the baseline check for values already in $Foswiki::cfg, and needs to be as fast as possible (it should not do any heavy processing).

Old checkers may not provide check_current_value but instead use the older signature check.

PROTECTED ObjectMethod warnAboutWindowsBackSlashes($path) -> $html

Generate a warning if the supplied pathname includes windows-style path separators.

PROVIDED FOR COMPATIBILITY ONLY - DO NOT USE! Use inheritance of Checkers::PATH behaviour instead.

PROTECTED ObjectMethod checkExpandedValue($reporter) -> $value

Report the expanded value of a parameter. Return the expanded value.

Topic revision: r1 - 21 Nov 2014, ProjectContributor
This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback