XML::DB::DatabaseManager - an approximation to the XML:DB DatabaseManager |
XML::DB::DatabaseManager - an approximation to the XML:DB DatabaseManager
use XML::DB::DatabaseManager;
my $driver = 'Xindice'; my $url = 'http://localhost:4080';
eval{ $dbm = new XML::DB::DatabaseManager(); $dbm->registerDatabase($driver); $col = $dbm->getCollection(``xmldb:$driver:$url/db/test''); ...... };
if ($@){ die $@; }
deregisterDatabase($driver);
This is the initial class to use to get access to the XML:DB modules, an approximate implementation of the XML:DB API defined for Java at http://www.xmldb.org. This implementation is designed to give a uniform Perl access over XML-RPC to both of the current free native XML databases, eXist and Xindice, as well as providing the same front-end for a plain file-system.
Unlike the DatabaseManager defined in the XML:DB API (which is a Factory), this simply registers driver names, generating a new Database instance for each request. Multiple database drivers can be used simultaneously (eg. to transfer data from one database to another). The drivers themselves are rather confusingly called 'Databases' in this system.
Only one DatabaseManager can be instantiated in a program.
Graham Seaman CPAN ID: GSEAMAN graham@opencollector.org
Copyright (c) 2002 Graham Seaman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
XML::DB::Collection, XML::DB::Resource, XML::DB::Database, XML::DB::ResourceSet, XML::DB::Resource::XMLResource, XML::DB::Service::XPathQueryService, XML::DB::Service::XUpdateQueryService, XML::DB::Database::File, XML::DB::Database::Xindice, XML::DB::Database::Exist.
Usage : $databaseManager = new DatabaseManager;
Purpose : Constructor for singleton
Returns : The DatabaseManager
Argument : None
Usage : $databaseManager->registerDatabase($database);
Purpose : Stores names of database drivers in $self
Returns : void
Argument : Database name
Usage : $databaseManager->deregisterDatabase($driverName);
Purpose : Remove database driver name from $self
Returns : void
Argument : Driver name
Usage : $databaseManager->getCollection($uri, $name, $passwd);
Purpose : Stores names of database drivers in $self
Returns : void
Argument : full uri for a collection
Comment : username and password are ignored, but here for possible future drivers.
XML::DB::DatabaseManager - an approximation to the XML:DB DatabaseManager |