The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

UMMF::Core::Configurable - Configurable object base class.

SYNOPSIS

  use base qw(UMMF::Core::Configurable)

  my $configurable = ...->new();

  my $value = $configurable->config_value($modelElement, $name, $default);

DESCRIPTION

This superclass is used by UMMF::UML::Export and UMMF::UML::XForm to get configuration data for a particular ModelELement, from mulitple sources:

  • the defined override hash

  • command line options (to be implemented)

  • the ModelElement's taggedValues

This minimizes coupling between the Model, the Model transforms applied and control of the Model transforms.

The $self->config_*($model_element, $key, $default) methods all search for values in a particular order:

1. $self->{'override'}{$kind}{$name}{$key}
2. $self->{'override'}{$kind}{'*'}{$key}
3. $self->{'override'}{'*'}{$name}{$key}
4. $self->{'override'}{'*'}{'*'}{$key}
5. the $model_elements TaggedValues:
5.1. "ummf.$kind.$key"
5.2. "ummf.$key"
6. Any specified profile, via UMMF::Config::Profile.
7. finally, the $default value.

where $name is the fully-qualified name of the $model_element, and $kind is $self->config_kind.

If $default is a CODE ref, the $default->() result is used.

This allows options during Model processing to be handled in a general manner, and be specific for a particular transformation.

Thus, 'ummf.Perl.foobar' will be selected before 'ummf.foobar' if $self->config_kind eq 'Perl'.

USAGE

  my $value = $configurable->config_*($model_element, $key, $default);

EXPORT

None exported.

AUTHOR

Kurt Stephens, kstephens@users.sourceforge.net 2003/08/05

SEE ALSO

UMMF::UML::MetaModel

VERSION

$Revision: 1.9 $

METHODS

config_kind

Returns the prefix used for this configurable object.

For example, UMMF::UML::Export::Perl::config_kind returns 'Perl' to select 'ummf.Perl.*' TaggedValues before others.

Subclasses must define this.