diff --git a/webtools/PLIF/PLIF/DataSource/Configuration.pm b/webtools/PLIF/PLIF/DataSource/Configuration.pm index ae32163e8891..1ca6118e9b4d 100644 --- a/webtools/PLIF/PLIF/DataSource/Configuration.pm +++ b/webtools/PLIF/PLIF/DataSource/Configuration.pm @@ -87,28 +87,6 @@ sub setInstalledModules { $self->database($app)->propertySet('PLIF.modulesList', $value); } -sub getDBIDatabaseSettings { - my $self = shift; - my($app, $database) = @_; - my $configuration = $self->database($app); - my $prefix = 'database.'.$database->class; - foreach my $property ($database->settings) { - my $value = $configuration->propertyGet("$prefix.$property"); - $self->assert($value, 1, "The configuration is missing a valid value for '$prefix.$property'"); - $database->propertySet($property, $value); - } -} - -sub setDBIDatabaseSettings { - my $self = shift; - my($app, $database) = @_; - my $configuration = $self->database($app); - my $prefix = 'database.'.$database->class; - foreach my $property ($database->settings) { - $configuration->propertySet("$prefix.$property", $database->propertyGet($property)); - } -} - # this takes an object supporting the dataSource.configuration.client # service and retrieves its settings. sub getSettings { @@ -117,7 +95,7 @@ sub getSettings { my $configuration = $self->database($app); foreach my $property ($object->settings) { my $value = $configuration->propertyGet("$prefix.$property"); - $self->assert($value, 1, "The configuration is missing a valid value for '$prefix.$property'"); + $self->assert(defined($value), 1, "The configuration is missing a valid value for '$prefix.$property'"); $object->propertySet($property, $value); } } diff --git a/webtools/PLIF/PLIF/Database/DBI.pm b/webtools/PLIF/PLIF/Database/DBI.pm index e1bfc0c3130f..1ade7bde420a 100644 --- a/webtools/PLIF/PLIF/Database/DBI.pm +++ b/webtools/PLIF/PLIF/Database/DBI.pm @@ -37,7 +37,9 @@ use PLIF::Database::ResultsFrame::DBI; sub provides { my $class = shift; my($service) = @_; - return ($service eq 'setup.configure' or $class->SUPER::provides($service)); + return ($service eq 'setup.configure' or + $service eq 'dataSource.configuration.client' or + $class->SUPER::provides($service)); } # the name used to identify this database in the configuration @@ -135,7 +137,7 @@ sub createResultsFrame { sub getConfig { my $self = shift; my($app) = @_; - $app->getService('dataSource.configuration')->getDBIDatabaseSettings($app, $self); + $app->getService('dataSource.configuration')->getSettings($app, $self, 'database.'.$self->class); } sub propertyGetUndefined { @@ -149,6 +151,7 @@ sub propertyGetUndefined { return $self->SUPER::propertyGetUndefined(@_); } +# dataSource.configuration.client sub settings { # if you change this, check out setupConfigure to make sure it is still up to date return qw(host port type name username password); @@ -177,7 +180,7 @@ sub setupConfigure { $data{'name'} =~ s/[^a-z]//gos; $data{'name'} = $self->setupConfigurePrompt($app, $prefix, 'name', $data{'name'}); $data{'username'} = $self->setupConfigurePrompt($app, $prefix, 'username', $data{'name'}); # default username to the same thing - $data{'password'} = $self->setupConfigurePrompt($app, $prefix, 'password'); + $data{'password'} = $self->setupConfigurePrompt($app, $prefix, 'password', ''); $self->dump(9, "got values, now sanity checking them."); @@ -194,7 +197,7 @@ sub setupConfigure { # save settings $app->output->setupProgress("$prefix.settings.saving"); - $app->getService('dataSource.configuration')->setDBIDatabaseSettings($app, $self); + $app->getService('dataSource.configuration')->setSettings($app, $self, 'database.'.$self->class); $self->dump(9, "checking to see if we can connect to the database."); @@ -231,7 +234,11 @@ sub setupConfigurePrompt { if (not defined($value)) { $value = $default; } - return $app->input->getArgument("$prefix.$property", $value); + if (defined($value)) { + return $app->input->getArgument("$prefix.$property", $value); + } else { + return $app->input->getArgument("$prefix.$property"); + } } # you should close the database handle before calling setupConfigureDatabase