Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Setup
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9412/OpenInteract2/Setup
Modified Files:
CheckDatasources.pm
Log Message:
OIN-54: add call to 'resolve_datasource_info()' and reassignment of
rewritten config back to server configuration
Index: CheckDatasources.pm
===================================================================
RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Setup/CheckDatasources.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** CheckDatasources.pm 24 Jan 2005 17:17:31 -0000 1.1
--- CheckDatasources.pm 19 Feb 2005 04:27:35 -0000 1.2
***************
*** 25,34 ****
classes => $ds_manager_class,
classes_type => 'Datasource Manager'
! );
$ctx->datasource_manager( $ds_manager_class );
$log->info( "Assigned datasource manager ok" );
! my $all_datasource_config = $ctx->lookup_datasource_config;
! while ( my ( $ds_name, $ds_info ) = each %{ $all_datasource_config } ) {
$log->info( "Checking datasource '$ds_name'..." );
unless ( ref $ds_info eq 'HASH' ) {
--- 25,38 ----
classes => $ds_manager_class,
classes_type => 'Datasource Manager'
! )->run();
$ctx->datasource_manager( $ds_manager_class );
$log->info( "Assigned datasource manager ok" );
! my %all_datasource_config = %{ $ctx->lookup_datasource_config };
! my %ds_to_manager = ();
! my %seen_types = ();
!
! # Check manager/SPOPS classes...
! while ( my ( $ds_name, $ds_info ) = each %all_datasource_config ) {
$log->info( "Checking datasource '$ds_name'..." );
unless ( ref $ds_info eq 'HASH' ) {
***************
*** 45,57 ****
$log->info( "Datasource '$ds_name' has valid type '$ds_type'" );
my $ds_config_handler = $ds_type_info->{spops_config};
! if ( $ds_config_handler ) {
! eval "require $ds_config_handler";
! if ( $@ ) {
! oi_error "Could not include module '$ds_config_handler' ",
! "to handle SPOPS configuration information: $@";
! }
! $log->info( "SPOPS handler for '$ds_type' require ok" );
! }
}
}
--- 49,73 ----
$log->info( "Datasource '$ds_name' has valid type '$ds_type'" );
my $ds_config_handler = $ds_type_info->{spops_config};
! my $ds_conn_handler = $ds_type_info->{connection_manager};
! $ds_to_manager{ $ds_name } = $ds_conn_handler;
! next if ( $seen_types{ $ds_type } );
!
! OpenInteract2::Setup->new(
! 'require classes',
! classes => [ $ds_config_handler, $ds_conn_handler ],
! classes_type => "Datasource $ds_type support"
! )->run();
! $seen_types{ $ds_type }++;
}
+
+ # now do any runtime munging...
+ while ( my ( $ds_name, $ds_info ) = each %all_datasource_config ) {
+ my $ds_conn_handler = $ds_to_manager{ $ds_name };
+ my $new_info = $ds_conn_handler->resolve_datasource_info(
+ $ds_name, $ds_info
+ );
+ $ctx->assign_datasource_config( $ds_name, $new_info );
+ }
+
}
***************
*** 107,112 ****
=item *
! If there's an entry for 'spops_config' under 'datasource_type.$type'
! we try to bring in the class it references.
=back
--- 123,136 ----
=item *
! Bring in class entries under 'datasource_type.$type' for
! 'spops_config' and 'connection_manager'.
!
! =item *
!
! For each datasource defined, run it though that datasource's
! connection manager (tied to the 'type') and assign that information
! back to the context via C<assign_datasource_config()>. This allows us
! to modify the configuration at runtime to make the configurations
! easier for users.
=back
|