| 1293 |
dpurdie |
1 |
###############################################################################
|
|
|
2 |
# Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
|
|
|
3 |
# sits@users.sourceforge.net
|
|
|
4 |
#
|
|
|
5 |
# This program is free software; you can redistribute it and modify it under
|
|
|
6 |
# the terms of the GPL.
|
|
|
7 |
|
|
|
8 |
# Factory class for retrieving a bug database connection.
|
|
|
9 |
|
|
|
10 |
package Codestriker::BugDB::BugDBConnectionFactory;
|
|
|
11 |
|
|
|
12 |
use strict;
|
|
|
13 |
use Codestriker::BugDB::BugzillaConnection;
|
|
|
14 |
use Codestriker::BugDB::FlysprayConnection;
|
|
|
15 |
use Codestriker::BugDB::NoConnection;
|
|
|
16 |
|
|
|
17 |
# Factory method for retrieving a BugDBConnection object.
|
|
|
18 |
sub getBugDBConnection ($) {
|
|
|
19 |
my ($type) = @_;
|
|
|
20 |
|
|
|
21 |
my $dbtype = $Codestriker::bug_db;
|
|
|
22 |
if ($dbtype eq "bugzilla") {
|
|
|
23 |
return Codestriker::BugDB::BugzillaConnection->get_connection();
|
|
|
24 |
} elsif ($dbtype eq "flyspray") {
|
|
|
25 |
return Codestriker::BugDB::FlysprayConnection->get_connection();
|
|
|
26 |
} elsif ($dbtype =~ /^noconnect/) {
|
|
|
27 |
return Codestriker::BugDB::NoConnection->get_connection();
|
|
|
28 |
} else {
|
|
|
29 |
die "Unsupported bug database type: $dbtype";
|
|
|
30 |
}
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
1;
|