--- nfo/perl/libs/Data/Storage/Container.pm 2003/01/30 22:21:52 1.7 +++ nfo/perl/libs/Data/Storage/Container.pm 2003/02/18 19:19:47 1.8 @@ -1,8 +1,11 @@ ################################################ # -# $Id: Container.pm,v 1.7 2003/01/30 22:21:52 joko Exp $ +# $Id: Container.pm,v 1.8 2003/02/18 19:19:47 joko Exp $ # # $Log: Container.pm,v $ +# Revision 1.8 2003/02/18 19:19:47 joko +# + modified locator handling +# # Revision 1.7 2003/01/30 22:21:52 joko # + changed 'connect'-behaviour back to old state # + renamed log-output (now using 'initializing' instead of 'booting' - corresponding to 'initStorage') @@ -47,9 +50,10 @@ use Tie::IxHash; use Data::Dumper; -use Data::Transform::Deep qw( deep_copy ); use Data::Storage; -#use Data::Storage::Locator; +use Data::Storage::Locator; +use Data::Transform::Deep qw( deep_copy ); +use Data::Compare::Struct qw( isEmpty ); sub new { my $invocant = shift; @@ -101,8 +105,9 @@ my $self = shift; my $name = shift; my $db_config = $self->{config}->{$name}; + $db_config ||= {}; - $logger->debug( __PACKAGE__ . "->initLocator( db_config $db_config )" ); + $logger->debug( __PACKAGE__ . "->initLocator( name='$name' )" ); my $cfg_locator = {}; @@ -112,9 +117,6 @@ $cfg_locator->{$_} = $default->{$_}; } - # name it - $cfg_locator->{name} = $name; - # merge in specific settings my $specific = deep_copy($db_config); foreach (keys %$specific) { @@ -130,6 +132,19 @@ # HACK: set errorhandler if dbi settings are present $cfg_locator->{dbi}->{HandleError} = \&_dbErrorHandler if $cfg_locator->{dbi}; + # trace + #print "locator:", "\n"; + #print Dumper($cfg_locator); + + # check locator metadata + if (isEmpty($cfg_locator)) { + $logger->warning( __PACKAGE__ . "->initLocator( name='$name' ): Metadata was empty. Please check configuration." ); + return; + } + + # name it + $cfg_locator->{name} = $name; + # create new locator object $self->{locator}->{$name} = Data::Storage::Locator->new( $cfg_locator );