cvsuser     02/01/06 12:57:07

  Modified:    P5EEx/Blue/P5EEx/Blue LogChannel.pm Messaging.pm
                        Procedure.pm Repository.pm Security.pm
                        Serializer.pm Service.pm Template.pm Widget.pm
               P5EEx/Blue/P5EEx/Blue/Repository DBI.pm Sample.pm
  Log:
  cleaning up the Service constructors (and Repository particularly) so that they 
actuall work
  
  Revision  Changes    Path
  1.2       +28 -1     p5ee/P5EEx/Blue/P5EEx/Blue/LogChannel.pm
  
  Index: LogChannel.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/LogChannel.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- LogChannel.pm     5 Dec 2001 22:45:03 -0000       1.1
  +++ LogChannel.pm     6 Jan 2002 20:57:07 -0000       1.2
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: LogChannel.pm,v 1.1 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: LogChannel.pm,v 1.2 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::LogChannel;
  @@ -121,6 +121,33 @@
       my ($self, @text) = @_;
       print STDERR @text, "\n";
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'LogChannel';
  +
  +    * Signature: $service_type = P5EEx::Blue::LogChannel->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'LogChannel'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.4       +28 -1     p5ee/P5EEx/Blue/P5EEx/Blue/Messaging.pm
  
  Index: Messaging.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Messaging.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- Messaging.pm      5 Dec 2001 22:45:03 -0000       1.3
  +++ Messaging.pm      6 Jan 2002 20:57:07 -0000       1.4
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Messaging.pm,v 1.3 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: Messaging.pm,v 1.4 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Messaging;
  @@ -185,6 +185,33 @@
       my $self = shift;
       my %args = @_;
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'Messaging'.
  +
  +    * Signature: $service_type = P5EEx::Blue::Messaging->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Messaging'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.3       +28 -1     p5ee/P5EEx/Blue/P5EEx/Blue/Procedure.pm
  
  Index: Procedure.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Procedure.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -w -r1.2 -r1.3
  --- Procedure.pm      5 Dec 2001 22:45:03 -0000       1.2
  +++ Procedure.pm      6 Jan 2002 20:57:07 -0000       1.3
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Procedure.pm,v 1.2 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: Procedure.pm,v 1.3 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Procedure;
  @@ -131,6 +131,33 @@
   sub execute {
       my $self = shift;
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'Procedure';
  +
  +    * Signature: $service_type = P5EEx::Blue::Procedure->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Procedure'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.4       +74 -71    p5ee/P5EEx/Blue/P5EEx/Blue/Repository.pm
  
  Index: Repository.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Repository.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- Repository.pm     5 Dec 2001 22:45:03 -0000       1.3
  +++ Repository.pm     6 Jan 2002 20:57:07 -0000       1.4
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Repository.pm,v 1.3 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: Repository.pm,v 1.4 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Repository;
  @@ -266,92 +266,68 @@
   
   # $rep = Repository::Base->new();
   
  -sub new {
  -    my $this = shift;
  -    my ($class, $self);
  -    $self = {};
  -
  -    # contructing a new object from scratch from the class
  -    # i.e. $rep = Repository::Base->new(...);
  -    if (ref($this) eq "") {
  -        $class = $this;       # must be a scalar, presumably a class name
  -        bless $self, $class;
  -        $self->init_base(@_);
  -    }
  -    # contructing a new object from another object
  -    # $rep = $rep1->new();
  -    else {
  -        $class = ref($this);
  -        bless $self, $class;
  -        $self->init_base($this->{name},$this->{config});
  -    }
  -
  -    $self->init();
  -
  -    if (!$self->connect()) {
  -        my ($repname, $repconfig);
  -        $repconfig = $self->{repconfig};
  -
  -        print STDERR "Error on connect():";
  -        foreach (keys %$repconfig) {
  -            print STDERR " $_=[", $repconfig->{$_}, "]";
  -        }
  -        print STDERR "\n";
  -        return(undef);
  -    }
  -
  -    $self->load_rep_metadata();
  -
  -    return $self;
  -}
  +#sub new {
  +#    my $this = shift;
  +#    my ($class, $self);
  +#    $self = {};
  +#
  +#    # contructing a new object from scratch from the class
  +#    # i.e. $rep = Repository::Base->new(...);
  +#    if (ref($this) eq "") {
  +#        $class = $this;       # must be a scalar, presumably a class name
  +##        bless $self, $class;
  +#        $self->init_service(@_);
  +#    }
  +#    # contructing a new object from another object
  +#    # $rep = $rep1->new();
  +#    else {
  +#        $class = ref($this);
  +#        bless $self, $class;
  +#        $self->init_service($this->{name},$this->{config});
  +#    }
  +#
  +#    return $self;
  +#}
   
   #####################################################################
  -# init_base()
  +# init_service()
   # initialize the {config} structure and the {name} attribute
   #####################################################################
  -sub init_base {
  -    my $self = shift;
  +sub init_service {
  +    my ($self, $args) = @_;
       my ($dbidriver, $dbname, $dbuser, $dbpass, $dbioptions, $dbschema);
  -    my ($repname, $config, $repconfig);
  +    my ($name, $config, $repconfig);
   
  -    # $rep = Repository::Base->new();                # looks for %ENV, then config 
file
  -    # $rep = Repository::Base->new($config);         # a MySQL database named 
"mydb" (the default)
  -    # $rep = Repository::Base->new("sysdb");         # looks for %ENV, then config 
file using "sysdb"
  -    # $rep = Repository::Base->new("sysdb",$config); # an Oracle database named 
"SYSDB"
  -
  -    if ($#_ == -1) {
  -        $repname = "db";
  -        $config  = Repository->read_config();
  -    }
  -    elsif ($#_ == 0 && ref($_[0]) eq "") {
  -        $repname = shift;
  -        $config  = Repository->read_config();
  -    }
  -    elsif ($#_ == 0 && (ref($_[0]) eq "HASH" || ref($_[0]) =~ /^Widget::/)) {
  -        $repname = "db";
  -        $config  = shift;
  -    }
  -    elsif ($#_ == 1 && (ref($_[1]) eq "HASH" || ref($_[1]) =~ /^Widget::/)) {
  -        $repname = shift;
  -        $config  = shift;
  -    }
  -    else {
  -        $repname = "db";
  -        $config  = $self->make_config(@_);
  -    }
  +    $name = $args->{name};
   
  -    $self->{name}    = $repname;
  +    $self->{name}    = $name;
       $self->{config}  = $config;
   
       $self->{numrows} = 0;
       $self->{error}   = "";
   
  -    $repconfig = $config->{repository}{$repname};
  +    $repconfig = $self->{config};
       if (!$repconfig || ref($repconfig) ne "HASH") {
  -        print STDERR "Error: config does not have an entry for the $repname 
repository (\$conf->{repository}{$repname})\n";
  +        print STDERR "Error: config does not have an entry for the [$name] 
repository (\$conf->{repository}{$name})\n";
           return(undef);
       }
       $self->{repconfig} = $repconfig;
  +
  +    $self->init($args);
  +
  +    if (!$self->connect()) {
  +        my ($repconfig);
  +        $repconfig = $self->{repconfig};
  +
  +        print STDERR "Error on connect():";
  +        foreach (keys %$repconfig) {
  +            print STDERR " $_=[", $repconfig->{$_}, "]";
  +        }
  +        print STDERR "\n";
  +        return(undef);
  +    }
  +
  +    $self->load_rep_metadata();
   }
   
   sub init { }         # OVERRIDE IN SUBCLASS
  @@ -974,6 +950,33 @@
   sub rollback {
       my $self = shift;
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'Repository';
  +
  +    * Signature: $service_type = P5EEx::Blue::Repository->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Repository'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.4       +28 -1     p5ee/P5EEx/Blue/P5EEx/Blue/Security.pm
  
  Index: Security.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Security.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- Security.pm       5 Dec 2001 22:45:03 -0000       1.3
  +++ Security.pm       6 Jan 2002 20:57:07 -0000       1.4
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Security.pm,v 1.3 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: Security.pm,v 1.4 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Security;
  @@ -134,6 +134,33 @@
   sub tbd {
       my ($self) = @_;
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'Security';
  +
  +    * Signature: $service_type = P5EEx::Blue::Security->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Security'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.4       +28 -1     p5ee/P5EEx/Blue/P5EEx/Blue/Serializer.pm
  
  Index: Serializer.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Serializer.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- Serializer.pm     5 Dec 2001 22:45:03 -0000       1.3
  +++ Serializer.pm     6 Jan 2002 20:57:07 -0000       1.4
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Serializer.pm,v 1.3 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: Serializer.pm,v 1.4 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Serializer;
  @@ -254,6 +254,33 @@
       $d->Indent(1);
       return $d->Dump();
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'Serializer';
  +
  +    * Signature: $service_type = P5EEx::Blue::Serializer->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Serializer'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.5       +95 -9     p5ee/P5EEx/Blue/P5EEx/Blue/Service.pm
  
  Index: Service.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Service.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- Service.pm        11 Dec 2001 05:03:46 -0000      1.4
  +++ Service.pm        6 Jan 2002 20:57:07 -0000       1.5
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Service.pm,v 1.4 2001/12/11 05:03:46 spadkins Exp $
  +## $Id: Service.pm,v 1.5 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Service;
  @@ -55,10 +55,30 @@
       * Throws:    P5EEx::Blue::Exception
       * Since:     0.01
   
  -    Sample Usage: (never used because this is a base class)
  +    Sample Usage: (never used because this is a base class, but the
  +    constructors of all services follow these rules)
   
  -    $service = P5EEx::Blue::Service->new();
  -    $service = P5EEx::Blue::Service->new(
  +    * If the first constructor arg is a hashref, it is used as a base
  +      set of arguments or base config
  +    * If the number arguments remaining is odd, the next arg is the 
  +      service name
  +    * If there are remaining arguments, they are variable/value pairs
  +    * If there are no arguments at all, the "default" name is assumed
  +    * If a "name" was supplied using any of these methods,
  +      the master config is consulted to find the config for this
  +      particular service instance (service_type/name). Otherwise,
  +      the service is an "anonymous" service and the resulting arg hashref
  +      is assumed to be the sum total of its configuration information.
  +      (No config file is needed or consulted.)
  +
  +    $service = P5EEx::Blue::Service->new();        # assumes "default" name
  +    $service = P5EEx::Blue::Service->new("srv1");  # instantiate named service
  +    $service = P5EEx::Blue::Service->new(          # anonymous
  +        arg1 => 'value1',
  +        arg2 => 'value2',
  +    );
  +    $service = P5EEx::Blue::Service->new(\%baseargs, "srv1");
  +    $service = P5EEx::Blue::Service->new(\%baseargs, # anonymous
           arg1 => 'value1',
           arg2 => 'value2',
       );
  @@ -72,9 +92,10 @@
       bless $self, $class;
   
       my ($name, $args, $i);
  +    $name = "";
       if ($#_ == -1) {
           $args = {};
  -        $name = "default";
  +        $args->{name} = "default";
       }
       else {
           if (ref($_[0]) eq "HASH") {
  @@ -88,16 +109,43 @@
               $name = shift if ($#_ % 2 == 0);
               $args = ($#_ > -1) ? { @_ } : {};
           }
  -        $name = $args->{name} if (!$name);
  -        $name = "default" if (!$name);
  +        $args->{name} = $name if ($name);
  +    }
  +    if ($args->{name}) {
  +        my ($config, $service_type);
  +        $config = P5EEx::Blue::P5EE->config();
  +        $service_type = $self->service_type();
  +        $self->{config} = $config->{$service_type}{$name};
  +    }
  +    else {
  +        $self->{config} = $args;   # this is all there is
       }
   
  -    $self->init($args);
  +    $self->init_service($args);
   
       return $self;
   }
   
   #############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns the service type (i.e. Repository, Procedure, Widget, etc.).
  +
  +    * Signature: $service_type = P5EEx::Blue::Service->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Service'; }
  +
  +#############################################################################
   # Method: absorbable_attribs()
   #############################################################################
   
  @@ -133,6 +181,36 @@
   =cut
   
   #############################################################################
  +# Method: init_service()
  +#############################################################################
  +
  +=head2 init_service()
  +
  +The init_service() method is called from within the standard Service
  +constructor.
  +It allows subclasses of the Service to customize the behavior of the
  +constructor by overriding the init_service() method. 
  +The init_service() method in this class simply calls the init() 
  +method to allow each service instance to initialize itself.
  +
  +    * Signature: init_service($named)
  +    * Param:     $named      {}   [in]
  +    * Return:    void
  +    * Throws:    P5EEx::Blue::Exception
  +    * Since:     0.01
  +
  +    Sample Usage: 
  +
  +    $service->init_service($args);
  +
  +=cut
  +
  +sub init_service {
  +    my ($self, $args) = @_;
  +    $self->init($args);
  +}
  +
  +#############################################################################
   # Method: init()
   #############################################################################
   
  @@ -142,6 +220,14 @@
   The init() method in this class does nothing.
   It allows subclasses of the Service to customize the behavior of the
   constructor by overriding the init() method. 
  +
  +The difference between init_service() and init() is twofold.
  +First, init_service() is called before init().
  +Second, the init_service() method is expected to be overridden in the
  +base class of the particular service, whereas init() is expected to
  +be overridden in the specific class of the service.
  +(i.e. init_service() is overridden in P5EEx::Blue::Repository,
  +whereas init() is overridden in P5EEx::Blue::Repository::DBI.)
   
       * Signature: init($named)
       * Param:     $named      {}   [in]
  
  
  
  1.2       +28 -1     p5ee/P5EEx/Blue/P5EEx/Blue/Template.pm
  
  Index: Template.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Template.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- Template.pm       5 Dec 2001 22:45:03 -0000       1.1
  +++ Template.pm       6 Jan 2002 20:57:07 -0000       1.2
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Template.pm,v 1.1 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: Template.pm,v 1.2 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Template;
  @@ -130,6 +130,33 @@
   sub tbd {
       my ($self) = @_;
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'Template';
  +
  +    * Signature: $service_type = P5EEx::Blue::Template->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Template'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.4       +28 -1     p5ee/P5EEx/Blue/P5EEx/Blue/Widget.pm
  
  Index: Widget.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Widget.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -w -r1.3 -r1.4
  --- Widget.pm 5 Dec 2001 22:45:03 -0000       1.3
  +++ Widget.pm 6 Jan 2002 20:57:07 -0000       1.4
  @@ -1,6 +1,6 @@
   
   #############################################################################
  -## $Id: Widget.pm,v 1.3 2001/12/05 22:45:03 spadkins Exp $
  +## $Id: Widget.pm,v 1.4 2002/01/06 20:57:07 spadkins Exp $
   #############################################################################
   
   package P5EEx::Blue::Widget;
  @@ -134,6 +134,33 @@
   sub tbd {
       my ($self) = @_;
   }
  +
  +#############################################################################
  +# PROTECTED METHODS
  +#############################################################################
  +
  +=head1 Protected Methods:
  +
  +=cut
  +
  +#############################################################################
  +# Method: service_type()
  +#############################################################################
  +
  +=head2 service_type()
  +
  +Returns 'Widget';
  +
  +    * Signature: $service_type = P5EEx::Blue::Widget->service_type();
  +    * Param:     void
  +    * Return:    $service_type  string
  +    * Since:     0.01
  +
  +    $service_type = $widget->service_type();
  +
  +=cut
  +
  +sub service_type () { 'Widget'; }
   
   =head1 ACKNOWLEDGEMENTS
   
  
  
  
  1.2       +36 -34    p5ee/P5EEx/Blue/P5EEx/Blue/Repository/DBI.pm
  
  Index: DBI.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Repository/DBI.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- DBI.pm    4 Jan 2002 16:41:05 -0000       1.1
  +++ DBI.pm    6 Jan 2002 20:57:07 -0000       1.2
  @@ -1,35 +1,36 @@
   
   ######################################################################
  -## File: $Id: DBI.pm,v 1.1 2002/01/04 16:41:05 spadkins Exp $
  +## File: $Id: DBI.pm,v 1.2 2002/01/06 20:57:07 spadkins Exp $
   ######################################################################
   
  -use Repository;
  +use P5EEx::Blue::P5EE;
  +use P5EEx::Blue::Repository;
   
  -package Repository::DBI;
  -$VERSION = do { my @r=(q$Revision: 1.1 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +package P5EEx::Blue::Repository::DBI;
  +$VERSION = do { my @r=(q$Revision: 1.2 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
  -use Repository::Base;
  -@ISA = ( "Repository::Base" );
  +use P5EEx::Blue::Repository;
  +@ISA = ( "P5EEx::Blue::Repository" );
   
   use strict;
   
   =head1 NAME
   
  -Repository::DBI - a repository which relies on a DBI interface to a relational 
database
  +P5EEx::Blue::Repository::DBI - a repository which relies on a DBI interface to a 
relational database
   
   =head1 SYNOPSIS
   
  -   use Repository::DBI;
  +   use P5EEx::Blue::Repository::DBI;
   
  -   (see man page for Repository::Base for additional methods)
  +   (see man page for P5EEx::Blue::Repository for additional methods)
   
  -   $rep = Repository::DBI->new();        # looks for %ENV, then config file
  -   $rep = Repository::DBI->new("mysql","mydb","user001","pass001");
  -   $rep = Repository::DBI->new("mysql","mydb","user001","pass001","port=3307");
  -   $rep = 
Repository::DBI->new("mysql","mydb","user001","pass001","port=3307","user001");
  +   $rep = P5EEx::Blue::Repository::DBI->new();        # looks for %ENV, then config 
file
  +   $rep = P5EEx::Blue::Repository::DBI->new("mysql","mydb","user001","pass001");
  +   $rep = 
P5EEx::Blue::Repository::DBI->new("mysql","mydb","user001","pass001","port=3307");
  +   $rep = 
P5EEx::Blue::Repository::DBI->new("mysql","mydb","user001","pass001","port=3307","user001");
   
      ###################################################################
  -   # methods not defined in the Repository::Base interface
  +   # methods not defined in the P5EEx::Blue::Repository interface
      ###################################################################
   
      # UTILITY FUNCTIONS: to support the next level of functionality
  @@ -41,7 +42,7 @@
      $delete_sql = $rep->mk_delete_rows_sql($table,                      \@params, 
\%paramvalues);
   
      ###################################################################
  -   # defined in the Repository::Base interface, implemented here
  +   # defined in the P5EEx::Blue::Repository interface, implemented here
      ###################################################################
   
      $ok = $rep->connect();         # initialize repository (will happen 
automatically in constructor)
  @@ -126,7 +127,7 @@
   
   =head1 DESCRIPTION
   
  -The Repository::DBI class encapsulates all access to the database,
  +The P5EEx::Blue::Repository::DBI class encapsulates all access to the database,
   changing SQL statements into get(), save(), and delete() methods.
   
   =cut
  @@ -138,6 +139,7 @@
   sub init {
       my $self = shift;
       my ($name, $repconf);
  +    $repconfig = P5EEx::Blue::P5EE->config();
   
       $name    = $self->{name};
       $repconf = $self->{repconfig};
  @@ -265,7 +267,7 @@
   }
   
   ######################################################################
  -# SQL EXECUTE METHODS (new methods not defined in Repository::Base)
  +# SQL EXECUTE METHODS (new methods not defined in P5EEx::Blue::Repository)
   ######################################################################
   
   # $colvararr = $rep->exec_select_row($sql);
  @@ -382,7 +384,7 @@
   }
   
   ######################################################################
  -# SQL CREATE METHODS (new methods not defined in Repository::Base)
  +# SQL CREATE METHODS (new methods not defined in P5EEx::Blue::Repository)
   ######################################################################
   
   sub mk_where_clause {
  @@ -466,17 +468,17 @@
       my ($self, $table, $columnref, $paramref, $paramvaluehref, $ordercolref, 
$startrow, $endrow,
           $sortdircolref, $keycolidxref, $writeref, $reptyperef, $summarykeyref) = @_;
   
  -    if ($Repository::DEBUG && 
Repository->dbg(ref($self),"mk_select_joined_rows_sql")) {
  -        Repository->dbgprint("mk_select_joined_rows_sql($table, col=$columnref, 
p=$paramref, pv=$paramvaluehref, oc=$ordercolref start=$startrow end=$endrow 
dir=$sortdircolref, key=$keycolidxref, w=$writeref, typ=$reptyperef, 
sum=$summarykeyref)");
  -        Repository->dbgprint("   columnref=[",     join(",",@$columnref),     "]") 
if ($columnref);
  -        Repository->dbgprint("   paramref=[",      join(",",@$paramref),      "]") 
if ($paramref);
  -        Repository->dbgprint("   paramvaluehref=[",join(",",%$paramvaluehref),"]") 
if ($paramvaluehref);
  -        Repository->dbgprint("   ordercolref=[",   join(",",@$ordercolref),   "]") 
if ($ordercolref);
  -        Repository->dbgprint("   sortdircolref=[", join(",",@$sortdircolref), "]") 
if ($sortdircolref);
  -        Repository->dbgprint("   keycolidxref=[",  join(",",@$keycolidxref),  "]") 
if ($keycolidxref);
  -        Repository->dbgprint("   writeref=[",      join(",",@$writeref),      "]") 
if ($writeref);
  -        Repository->dbgprint("   reptyperef=[",    join(",",@$reptyperef),    "]") 
if ($reptyperef);
  -        Repository->dbgprint("   summarykeyref=[", join(",",@$summarykeyref), "]") 
if ($summarykeyref);
  +    if ($P5EEx::Blue::Repository::DEBUG && 
P5EEx::Blue::Repository->dbg(ref($self),"mk_select_joined_rows_sql")) {
  +        P5EEx::Blue::Repository->dbgprint("mk_select_joined_rows_sql($table, 
col=$columnref, p=$paramref, pv=$paramvaluehref, oc=$ordercolref start=$startrow 
end=$endrow dir=$sortdircolref, key=$keycolidxref, w=$writeref, typ=$reptyperef, 
sum=$summarykeyref)");
  +        P5EEx::Blue::Repository->dbgprint("   columnref=[",     
join(",",@$columnref),     "]") if ($columnref);
  +        P5EEx::Blue::Repository->dbgprint("   paramref=[",      
join(",",@$paramref),      "]") if ($paramref);
  +        P5EEx::Blue::Repository->dbgprint("   
paramvaluehref=[",join(",",%$paramvaluehref),"]") if ($paramvaluehref);
  +        P5EEx::Blue::Repository->dbgprint("   ordercolref=[",   
join(",",@$ordercolref),   "]") if ($ordercolref);
  +        P5EEx::Blue::Repository->dbgprint("   sortdircolref=[", 
join(",",@$sortdircolref), "]") if ($sortdircolref);
  +        P5EEx::Blue::Repository->dbgprint("   keycolidxref=[",  
join(",",@$keycolidxref),  "]") if ($keycolidxref);
  +        P5EEx::Blue::Repository->dbgprint("   writeref=[",      
join(",",@$writeref),      "]") if ($writeref);
  +        P5EEx::Blue::Repository->dbgprint("   reptyperef=[",    
join(",",@$reptyperef),    "]") if ($reptyperef);
  +        P5EEx::Blue::Repository->dbgprint("   summarykeyref=[", 
join(",",@$summarykeyref), "]") if ($summarykeyref);
       }
   
       my ($table_def, $tablealiases, $tablealiashref);
  @@ -1130,7 +1132,7 @@
   }
   
   ######################################################################
  -# REPOSITORY METHODS (implements methods from Repository::Base)
  +# REPOSITORY METHODS (implements methods from P5EEx::Blue::Repository)
   ######################################################################
   
   # $colvalues = $rep->select_row ($table, \@cols, \@params, \%paramvalues);
  @@ -1262,7 +1264,7 @@
   }
   
   ######################################################################
  -# METADATA REPOSITORY METHODS (implements methods from Repository::Base)
  +# METADATA REPOSITORY METHODS (implements methods from P5EEx::Blue::Repository)
   ######################################################################
   
   use DBIx::Compat;
  @@ -1475,7 +1477,7 @@
   
       $tablealias = $table_def->{alias};
       if (! defined $tablealias) {
  -        $tablealias = "t" . Repository->serial("table");
  +        $tablealias = "t" . P5EEx::Blue::Repository->serial("table");
           $table_def->{alias} = $tablealias;
       }
   
  @@ -1581,9 +1583,9 @@
           }
       }
   
  -    if ($Repository::DEBUG >= 2 && 
Repository->dbg("Repository::DBI","load_table_metadata_auto",2)) {
  +    if ($P5EEx::Blue::Repository::DEBUG >= 2 && 
P5EEx::Blue::Repository->dbg("P5EEx::Blue::Repository::DBI","load_table_metadata_auto",2))
 {
           print "Table Metadata: $table\n";
  -        Repository->dump($table_def);
  +        P5EEx::Blue::Repository->dump($table_def);
       }
   }
   
  
  
  
  1.2       +15 -15    p5ee/P5EEx/Blue/P5EEx/Blue/Repository/Sample.pm
  
  Index: Sample.pm
  ===================================================================
  RCS file: /cvs/public/p5ee/P5EEx/Blue/P5EEx/Blue/Repository/Sample.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -w -r1.1 -r1.2
  --- Sample.pm 4 Jan 2002 16:41:05 -0000       1.1
  +++ Sample.pm 6 Jan 2002 20:57:07 -0000       1.2
  @@ -1,42 +1,42 @@
   
   ######################################################################
  -## File: $Id: Sample.pm,v 1.1 2002/01/04 16:41:05 spadkins Exp $
  +## File: $Id: Sample.pm,v 1.2 2002/01/06 20:57:07 spadkins Exp $
   ######################################################################
   
  -use Repository;
  +use P5EEx::Blue::Repository;
   
  -package Repository::Sample;
  -$VERSION = do { my @r=(q$Revision: 1.1 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
  +package P5EEx::Blue::Repository::Sample;
  +$VERSION = do { my @r=(q$Revision: 1.2 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
   
  -use Repository::Base;
  -@ISA = ( "Repository::Base" );
  +use P5EEx::Blue::Repository;
  +@ISA = ( "P5EEx::Blue::Repository" );
   
   use strict;
   
   =head1 NAME
   
  -Repository::Sample - a set of stubs for a repository implementation which can be 
copied and modified
  +P5EEx::Blue::Repository::Sample - a set of stubs for a repository implementation 
which can be copied and modified
   
   =head1 SYNOPSIS
   
  -   use Repository::Sample;
  +   use P5EEx::Blue::Repository::Sample;
   
  -   (see man page for Repository::Base for additional methods)
  +   (see man page for P5EEx::Blue::Repository for additional methods)
   
      ###################################################################
      # constructors
      ###################################################################
   
  -   $rep = Repository::Sample->new();
  +   $rep = P5EEx::Blue::Repository::Sample->new();
   
      ###################################################################
  -   # methods not defined in the Repository::Base interface
  +   # methods not defined in the P5EEx::Blue::Repository interface
      ###################################################################
   
      # ...
   
      ###################################################################
  -   # defined in the Repository::Base interface, implemented here
  +   # defined in the P5EEx::Blue::Repository interface, implemented here
      ###################################################################
   
      $ok = $rep->connect();         # initialize repository (will happen 
automatically in constructor)
  @@ -102,7 +102,7 @@
   
   =head1 DESCRIPTION
   
  -The Repository::Sample class is a file to be copied and modified
  +The P5EEx::Blue::Repository::Sample class is a file to be copied and modified
   in order to create a new implementation of a repository class.
   The methods defined below are stubs that need to be filled out.
   
  @@ -168,7 +168,7 @@
   }
   
   ######################################################################
  -# REPOSITORY METHODS (implements methods from Repository::Base)
  +# REPOSITORY METHODS (implements methods from P5EEx::Blue::Repository)
   ######################################################################
   
   # $colvalues = $rep->select_row ($table, \@cols, \@wherecols, \%wherevalues);
  @@ -242,7 +242,7 @@
   }
   
   ######################################################################
  -# METADATA REPOSITORY METHODS (implements methods from Repository::Base)
  +# METADATA REPOSITORY METHODS (implements methods from P5EEx::Blue::Repository)
   # (implement if desired. needed only if metadata already exists.)
   ######################################################################
   
  
  
  


Reply via email to