Home | Wiki | OI 1.x Docs | OI 2.x Docs OI logo

NAME

OpenInteract2::DatasourceManager - Base class for datasource connection managers

SYNOPSIS

 my $dbh  = CTX->datasource( 'main' );
 my $ldap = CTX->datasource( 'ldap' );
 # Use some of the other functionality
 my $manger = CTX->datasource_manager;
 my $dbi_manager = $manager->get_manager_class( 'DBI' );
 my $new_dbi_manager = $manager->set_manager_class( 'DBI',
                                                    'My::DBI::Manager' );

DESCRIPTION

This class provides a wrapper around connection methods for DBI, LDAP or any other type of connections needed. It caches the connections for reuse throughout the lifetime of the application, although it contains no behavior (yet) for keeping the connections alive.

An implementation of the connection manager should implement as class methods:

connect( $datasource_name, \%datasource_info )

disconnect( $datasource_handle|$datasource_name )

METHODS

datasource( $datasource_name )

Returns datasource mapping to $datasource_name. Your application is responsible for keeping different datasource names straight.

Returns: $datasource on success; throws some sort of exception on error.

disconnect( $dataource_name )

Disconnects datasource $datasource_name.

shutdown()

Disconnects all datasources.

get_datasource_info( $datasource_name )

Returns hashref of configuration information for $datasource_name. If $datasource_name is not found an exception is thrown.

BUGS

None known.

TO DO

Use Class::Factory?

See if we can/need to modify to use Class::Factory.

Implement keepalive functionality

Similar to Apache::DBI, use the ping() method and do a reconnect if the connection has gone stale.

SEE ALSO

OpenInteract2::Datasource::DBI

OpenInteract2::Datasource::LDAP

COPYRIGHT

Copyright (c) 2002-2003 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>

Generated from the OpenInteract 1.99_03 source.


Home | Wiki | OI 1.x Docs | OI 2.x Docs
SourceForge Logo