Kurt Stephens > UMMF > UMMF::Core::Builder

Download:
UMMF-1.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 1.023   Source  

NAME ^

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

SYNOPSIS ^

  use UMMF::Core::Factory;
  use UMMF::Core::Builder;
  my $factory = UMMF::Core::Factory->new(...);
  my $builder = UMMF::Core::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.23 $

METHODS ^

begin_Model

  $self->begin_Model($meta, \%attr, \%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.

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);

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().

begin_Package

  my $pkg = $self->begin_Package(\%attr, \%opts);

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($meta, \@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.

$meta defaults to 'Class';

$gens defaults to the current 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($meta, \%attr, \%opts);

Adds a new Attribute to the current Classifier.

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

add_Literal

  $self->add_Literal($meta, $attr, $opts);

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

add_Association

  my $x = add_Association($meta, \%attr, \%opts);

Adds a new Association between two or more participant Classifiers.

%attr 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.

add_Reference

  my $x = add_Reference($meta, \%attr, \%opts);

MOF only.

Adds a new Reference between a Classifer and an AssociationEnd.

%attr should have the same structure as an Reference object.

Resolution is elided until finish_Reference.

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.

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::Boot::Factory uses this notification to do magic finalizations of the constructed 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

syntax highlighting: