/[cvs]/nfo/perl/libs/Data/Storage.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Storage.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by joko, Sat Dec 7 03:37:23 2002 UTC revision 1.13 by joko, Tue Dec 17 21:54:12 2002 UTC
# Line 7  Line 7 
7  ############################################  ############################################
8  #  #
9  #  $Log$  #  $Log$
10    #  Revision 1.13  2002/12/17 21:54:12  joko
11    #  + feature when using Tangram:
12    #    + what? each object created should delivered with a globally(!?) unique identifier (GUID) besides the native tangram object id (OID)
13    #        + patched Tangram::Storage (jonen)
14    #        + enhanced Data::Storage::Schema::Tangram (joko)
15    #        + enhanced Data::Storage::Handler::Tangram 'sub getObjectByGuid' (jonen)
16    #    + how?
17    #        + each concrete (non-abstract) class gets injected with an additional field/property called 'guid' - this is done (dynamically) on schema level
18    #        + this property ('guid') gets filled on object creation/insertion from 'sub Tangram::Storage::_insert' using Data::UUID from CPAN
19    #        + (as for now) this property can get accessed by calling 'getObjectByGuid' on the already known storage-handle used throughout the application
20    #
21    #  Revision 1.12  2002/12/12 02:50:15  joko
22    #  + this now (unfortunately) needs DBI for some helper functions
23    #  + TODO: these have to be refactored to another scope! (soon!)
24    #
25    #  Revision 1.11  2002/12/11 06:53:19  joko
26    #  + updated pod
27    #
28  #  Revision 1.10  2002/12/07 03:37:23  joko  #  Revision 1.10  2002/12/07 03:37:23  joko
29  #  + updated pod  #  + updated pod
30  #  #
# Line 53  BEGIN { Line 71  BEGIN {
71    
72  =head1 NAME  =head1 NAME
73    
74  Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way    Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way
75    
76    
77  =head1 AIMS  =head1 AIMS
# Line 167  Data::Storage - Interface for accessing Line 185  Data::Storage - Interface for accessing
185    
186  =head2 NOTE  =head2 NOTE
187    
188  This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks.    This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks.
189  Please look at their documentation and/or this code for additional information.    Please look at their documentation and/or this code for additional information.
190    
191    
192  =head1 REQUIREMENTS  =head1 REQUIREMENTS
# Line 196  use warnings; Line 214  use warnings;
214  use Data::Storage::Locator;  use Data::Storage::Locator;
215  use Data::Dumper;  use Data::Dumper;
216    
217    # TODO: wipe out!
218    use DBI;
219    
220  # TODO: actually implement level (integrate with Log::Dispatch)  # TODO: actually implement level (integrate with Log::Dispatch)
221  my $TRACELEVEL = 0;  my $TRACELEVEL = 0;
222    
# Line 361  sub getDbName { Line 382  sub getDbName {
382    return $database_name;    return $database_name;
383  }  }
384    
385    sub testAvailability {
386      my $self = shift;
387      my $status = $self->testDsn();
388      $self->{locator}->{status}->{available} = $status;
389      return $status;
390    }
391    
392    sub isConnected {
393      my $self = shift;
394      # TODO: REVIEW!
395      return 1 if $self->{STORAGEHANDLE};
396    }
397    
398  sub testDsn {  sub testDsn {
399    my $self = shift;    my $self = shift;
400    my $dsn = $self->{locator}->{dbi}->{dsn};    my $dsn = $self->{locator}->{dbi}->{dsn};
# Line 378  sub testDsn { Line 412  sub testDsn {
412    }    }
413  }  }
414    
 sub testAvailability {  
   my $self = shift;  
   my $status = $self->testDsn();  
   $self->{locator}->{status}->{available} = $status;  
   return $status;  
 }  
   
   
415  sub dropDb {  sub dropDb {
416    my $self = shift;    my $self = shift;
417    my $dsn = $self->{locator}->{dbi}->{dsn};    my $dsn = $self->{locator}->{dbi}->{dsn};
# Line 413  sub dropDb { Line 439  sub dropDb {
439    return $ok;    return $ok;
440  }  }
441    
 sub isConnected {  
   my $self = shift;  
   return 1 if $self->{STORAGEHANDLE};  
 }  
   
442  1;  1;
443  __END__  __END__
444    
445    
446  =head1 DESCRIPTION  =head1 DESCRIPTION
447    
448  Data::Storage is a module for accessing various "data structures" stored inside  =head2 Data::Storage
 various "data containers". It sits on top of DBI and/or Tangram.  
449    
450      Data::Storage is a module for accessing various "data structures / kinds of structured data" stored inside
451      various "data containers".
452      We tried to use the AdapterPattern (http://c2.com/cgi/wiki?AdapterPattern) to implement a wrapper-layer
453      around core CPAN modules (Tangram, DBI).
454    
455    =head2 Why?
456    
457      You will get a better code-structure (not bad for later maintenance) in growing Perl code projects,
458      especially when using multiple database connections at the same time.
459      You will be able to switch between different _kinds_ of implementations used for storing data.
460      Your code will use the very same API to access these storage layers.
461          ... implementation has to be changed for now
462      Maybe you will be able to switch "on-the-fly" without changing any bits in code in the future....
463          ... but that's not the focus
464    
465  =head1 AUTHORS / COPYRIGHT  =head2 What else?
466    
467  The Data::Storage module is Copyright (c) 2002 Andreas Motl.    Having this, we were able to do implement a generic data synchronization module more easy,
468  All rights reserved.    please look at Data::Transfer.
469    
470  You may distribute it under the terms of either the GNU General Public  
471  License or the Artistic License, as specified in the Perl README file.  =head1 AUTHORS / COPYRIGHT
472    
473      The Data::Storage module is Copyright (c) 2002 Andreas Motl.
474      All rights reserved.
475      You may distribute it under the terms of either the GNU General Public
476      License or the Artistic License, as specified in the Perl README file.
477    
478    
479  =head1 ACKNOWLEDGEMENTS  =head1 ACKNOWLEDGEMENTS
480    
481  Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object,    Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object,
482  Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV and related,    Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV & Co.,
483  Adam Spiers for MySQL::Diff and all contributors.    Adam Spiers for MySQL::Diff and all contributors.
484    
485    
486  =head1 SUPPORT / WARRANTY  =head1 SUPPORT / WARRANTY
487    
488  Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.    Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.
489    
490    
491  =head1 TODO  =head1 TODO
# Line 526  Compare schema (structure diff) with dat Line 565  Compare schema (structure diff) with dat
565           - 'sub getACLByMethodname($id, $context)'           - 'sub getACLByMethodname($id, $context)'
566           - 'sub getACLByName($id, $context)'           - 'sub getACLByName($id, $context)'
567              ( would require a kinda registry to look up these very names pointing to arbitrary locations (code, data, ...) )              ( would require a kinda registry to look up these very names pointing to arbitrary locations (code, data, ...) )
568      - add more hooks and various levels
569      - better integrate introduced 'getObjectByGuid'-mechanism from Data::Storage::Handler::Tangram
570    
571    
572  =head3 LINKS / REFERENCES  =head3 LINKS / REFERENCES

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.13

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed