1 package com.atlassian.config.db;
2
3 import com.atlassian.core.util.PairType;
4 import com.atlassian.core.util.PropertyUtils;
5
6 import java.util.*;
7
8
9
10
11 public class DatabaseList
12 {
13
14 private List databases;
15
16
17
18
19 public DatabaseList()
20 {
21 this("supportedDatabases.properties");
22 }
23
24
25
26
27
28 public DatabaseList(String supportedDbFile)
29 {
30 databases = new ArrayList(7);
31 Properties dbProps = PropertyUtils.getProperties(supportedDbFile, DatabaseList.class);
32
33 List c = new ArrayList(dbProps.keySet());
34 Collections.sort(c);
35
36 for (Iterator it = c.iterator(); it.hasNext();)
37 {
38 String key = (String) it.next();
39 if (key.startsWith("key."))
40 databases.add(new PairType(dbProps.getProperty(key), dbProps.getProperty("value." + key.substring(4))));
41 }
42 }
43
44
45
46
47
48 public List getDatabases()
49 {
50 return databases;
51 }
52
53 }