UMMF::Export::Perl::Tangram - Tangram O/R tools.


UMMF documentation Contained in the UMMF distribution.

Index


Code Index:

NAME

Top

UMMF::Export::Perl::Tangram - Tangram O/R tools.

SYNOPSIS

Top

DESCRIPTION

Top

This package provides tools for managing Tangram persistance from UML models.

USAGE

Top

perl -MUMMF::Export::Perl::Tangram -e 'UMMF::Export::Perl::Tangram::main(@ARGV)' <dirs-to-scan>

EXPORT

Top

None exported.

TO DO

Top

AUTHOR

Top

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

SEE ALSO

Top

UMMF::Export::Perl, UMMF::Export::Perl::Tangram::Storage, UMMF::Export::Perl::Tangram::Schema (UMMF::Export::Perl::Schema)

VERSION

Top

$Revision: 1.10 $

METHODS

Top


UMMF documentation Contained in the UMMF distribution.

package UMMF::Export::Perl::Tangram;

use 5.6.0;
use strict;
use warnings;

our $AUTHOR = q{ kstephens@users.sourceforge.net 2003/04/06 };
our $VERSION = do { my @r = (q$Revision: 1.10 $ =~ /\d+/g); sprintf "%d." . "%03d" x $#r, @r };

#######################################################################

use base qw(UMMF::Core::Object);

#######################################################################


use UMMF::Export::Perl::Tangram::Schema;
use UMMF::Export::Perl::Tangram::Storage;
use Carp qw(confess);

#######################################################################


#######################################################################


sub main
{
  my (@args) = @_;

  if ( $args[0] eq __PACKAGE__ ) {
    shift @args;
  }

  my $action = shift @args;
  if ( grep($action eq $_, 'deploy', 'retreat') ) {
    my $to_db;
    if ( $args[0] eq '--to-db' ) {
      $to_db = shift @args;
    }

    my $s = UMMF::Export::Perl::Tangram::Schema->new;

    # Find all packages with __tangram_schema() functions.
    my @pkg = $s->locate_schema_packages(@args && \@args);
    
    #local $" = ', ';
    #print STDERR "schema packages = @pkg\n";
    
    # Get each __tangram__schema result for each package.
    my @schema = map($s->get_package_schema($_), @pkg);
    
    # Merge all the schemas.
    my $schema = $s->merge_schema(@schema);
    
    # Prepare schema.
    $schema = $s->prepare_schema($schema);
    
    # Deploy it to DB.
    if ( $action eq 'retreat' ) {
      # $DB::single = 1;
      $s->retreat_schema($schema, $to_db);
    } else {
      # $DB::single = 1;
      $s->deploy_schema($schema, $to_db);
    }
  } else {
    confess("Unknown action: '$action'");
  }

  0;
}


#######################################################################

1;

#######################################################################


### Keep these comments at end of file: kstephens@users.sourceforge.net 2003/04/06 ###
### Local Variables: ###
### mode:perl ###
### perl-indent-level:2 ###
### perl-continued-statement-offset:0 ###
### perl-brace-offset:0 ###
### perl-label-offset:0 ###
### End: ###