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

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

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

revision 1.7 by joko, Thu Jan 30 22:21:52 2003 UTC revision 1.8 by joko, Tue Feb 18 19:19:47 2003 UTC
# Line 3  Line 3 
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.8  2003/02/18 19:19:47  joko
7    #  + modified locator handling
8    #
9  #  Revision 1.7  2003/01/30 22:21:52  joko  #  Revision 1.7  2003/01/30 22:21:52  joko
10  #  + changed 'connect'-behaviour back to old state  #  + changed 'connect'-behaviour back to old state
11  #  + renamed log-output (now using 'initializing' instead of 'booting' - corresponding to 'initStorage')  #  + renamed log-output (now using 'initializing' instead of 'booting' - corresponding to 'initStorage')
# Line 47  my $logger = Log::Dispatch::Config->inst Line 50  my $logger = Log::Dispatch::Config->inst
50  use Tie::IxHash;  use Tie::IxHash;
51  use Data::Dumper;  use Data::Dumper;
52    
 use Data::Transform::Deep qw( deep_copy );  
53  use Data::Storage;  use Data::Storage;
54  #use Data::Storage::Locator;  use Data::Storage::Locator;
55    use Data::Transform::Deep qw( deep_copy );
56    use Data::Compare::Struct qw( isEmpty );
57    
58  sub new {  sub new {
59    my $invocant = shift;    my $invocant = shift;
# Line 101  sub initLocator { Line 105  sub initLocator {
105    my $self = shift;    my $self = shift;
106    my $name = shift;    my $name = shift;
107    my $db_config = $self->{config}->{$name};    my $db_config = $self->{config}->{$name};
108      $db_config ||= {};
109    
110    $logger->debug( __PACKAGE__ . "->initLocator( db_config $db_config )" );    $logger->debug( __PACKAGE__ . "->initLocator( name='$name' )" );
111    
112    my $cfg_locator = {};    my $cfg_locator = {};
113        
# Line 112  sub initLocator { Line 117  sub initLocator {
117      $cfg_locator->{$_} = $default->{$_};      $cfg_locator->{$_} = $default->{$_};
118    }    }
119        
   # name it  
   $cfg_locator->{name} = $name;  
     
120    # merge in specific settings    # merge in specific settings
121    my $specific = deep_copy($db_config);    my $specific = deep_copy($db_config);
122    foreach (keys %$specific) {    foreach (keys %$specific) {
# Line 130  sub initLocator { Line 132  sub initLocator {
132    # HACK: set errorhandler if dbi settings are present    # HACK: set errorhandler if dbi settings are present
133    $cfg_locator->{dbi}->{HandleError} = \&_dbErrorHandler if $cfg_locator->{dbi};    $cfg_locator->{dbi}->{HandleError} = \&_dbErrorHandler if $cfg_locator->{dbi};
134    
135      # trace
136        #print "locator:", "\n";
137        #print Dumper($cfg_locator);
138    
139      # check locator metadata
140      if (isEmpty($cfg_locator)) {
141        $logger->warning( __PACKAGE__ . "->initLocator( name='$name' ): Metadata was empty. Please check configuration." );
142        return;
143      }
144    
145      # name it
146      $cfg_locator->{name} = $name;
147    
148    # create new locator object    # create new locator object
149    $self->{locator}->{$name} = Data::Storage::Locator->new( $cfg_locator );    $self->{locator}->{$name} = Data::Storage::Locator->new( $cfg_locator );
150    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

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