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

NAME

UMMF::UML::MetaMetaModel::Builder - Constructs a Model from an input stream.

SYNOPSIS

  use UMMF::UML::MetaMetaModel::Factory;
  use UMMF::UML::MetaMetaModel::Builder;
  my $factory = UMMF::UML::MetaMetaModel::Factory->new(...);
  my $builder = UMMF::UML::MetaMetaModel::Builder->new('factory' => $factory);

  my $parser = SomeModelParser->new(...);
  $parser->parse($builder);

DESCRIPTION

Typically a model parser constructs one of these for handling parsing events.

This class manages creation of Models by managing scoping contexts for Model and Namespace during parsing of a meta-model or model description.

Once all the objects are created, the links between the ModelElements are finalized.

UMMF::UML::Import::MetaMetaModel uses this class during parsing of the UML meta-model specificiation file.

USAGE

EXPORT

None exported.

AUTHOR

Kurt Stephens, kstephens@users.sourceforge.net 2003/04/14

SEE ALSO

UMMF::UML::MetaModel.

VERSION

$Revision: 1.21 $

METHODS

begin_Model

  $self->begin_Model(%opts);

Begins a new Model in the current Namespace.

Model is a Namespace, so a new Namespace context is started.

If a Model has not been created yet $self->model_top_level is set to the new Model.

model

  my $model = $self->model;

Returns the current Model.

model_top_level

  my $model = $self->model_top_level;

Returns the top-level Model, i.e. the first Model created by $self->begin_Model().

end_Model

  my $model = $self->end_Model();

Terminates the current Model context, and resumes the previous Model and Namespace context.

Calls $self->finish_Model($model);

begin_Namespace

  my $ns = $self->begin_Namespace($ns);

Begins a new Namespace context.

end_Namespace

  my $ns = $self->end_Namespace();

Returns current namespace after restoring previous Namespace context.

begin_Package

  my $pkg = $self->begin_Package($name);

Creates a new Package and begins a new Namespace context using the new Package.

end_Package

  my $pkg = $self->end_Package();

Terminates the current Package context, and resumes the previous Namespace context.

add_Usage

  $self->add_Usage(@ns);

Added Usage Dependencies for the current Namespace.

Each @ns is a fully-qualified ModelElement name.

begin_Generalization_parent

   $self->Generalization_parent(\@model_element_name);

Begins a new Generalization parent context.

Classifiers created within this new Generalization parent context will specialize each of the @model_element by name, by default; i.e. no generalization parents are specified in the messages to $self->begin_Classifier().

This allows a short-hand notation for causing all Classifiers in a group to speciailize a set of other Classifiers.

end_Generalization_parent

Restores the previous Generalization parent context.

begin_Classifier

  my $cls = $self->begin_Classifier($name, $meta, $gens);

Creates a new Classifier and begins a new Namespace context using the new Classifier.

If $name contains '/', $cls->isAbstract will be true. (nmemonic: '/' implies leaning text: italics).

$meta defaults to 'Class';

$gens defaults to the curren Generalization_parent context.

end_Classifier

  my $cls->end_Classifier(@opts);

Terminates the current Classifier context, and resumes the previous Namespace context.

If $opts[1] is true, this quickly creates an empty Classifier before hand.

add_Attribute

  my $x = add_Attribute(\%x);

Adds a new Attribute to the current Classifier.

%x should have the same structure as an Attribute object would have.

add_EnumerationLiteral

  $self->add_EnumerationLiteral($name);

Adds a new EnumerationLiteral to the current Classifier, which must be an Enumeration.

add_Association

  my $x = add_Association(\%x);

Adds a new Association between two or more participant Classifiers.

%x should have the same structure as an Association object.

If an AssociationEnd's participant is '.' the current Namespace is used.

Each AssociationEnd's targetScope defaults to 'instance'.

Participant resolution is elided until finish_Association.

create

  my $obj = $self->create($name, @args);

Requests a new object of the $name type from the factory.

Subclasses can intercept all object creation here.

flush

  $self->flush($name);

Notifies the factory that all objects of the $name type have been created and can be vivified.

UMMF::UML::MetaMetaModel::FactoryBoot uses this notification to do magic finalizations of the constructed UML Model. This is only used for the initial bootstrapping of UMMF.

finish_Model

  my $self->finish_Model($model);

Completes constrution of the Model by completing the Usages, Generalizations, Attributes and Associations created so far.

The