--- nfo/perl/libs/Data/Storage/Container.pm 2003/01/30 22:21:52 1.7 +++ nfo/perl/libs/Data/Storage/Container.pm 2003/03/27 15:31:08 1.9 @@ -1,8 +1,14 @@ ################################################ # -# $Id: Container.pm,v 1.7 2003/01/30 22:21:52 joko Exp $ +# $Id: Container.pm,v 1.9 2003/03/27 15:31:08 joko Exp $ # # $Log: Container.pm,v $ +# Revision 1.9 2003/03/27 15:31:08 joko +# fixes to modules regarding new namespace(s) below Data::Mungle::* +# +# 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') @@ -11,7 +17,7 @@ # + temporary fix: (FIXME) now connecting to storage on storagehandle-instantiation # # Revision 1.5 2003/01/19 02:39:57 joko -# + moved 'deep_copy' from module 'libp' to module 'Data::Transform::Deep' +# + moved 'deep_copy' from module 'libp' to module 'Data.Transform.Deep' # + preserved order for hashes '$self->{config}' and '$self->{locator}' by using Tie::IxHash # # Revision 1.4 2002/12/04 07:38:07 jonen @@ -47,9 +53,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::Mungle::Transform::Deep qw( deep_copy ); +use Data::Mungle::Compare::Struct qw( isEmpty ); sub new { my $invocant = shift; @@ -101,8 +108,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 +120,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 +135,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 );