1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.dbunit;
23
24 import java.util.*;
25
26
27
28
29
30
31 public class DatabaseProfile
32 {
33 private static final String[] EMPTY_ARRAY = new String[0];
34
35 private static final String DATABASE_PROFILE = "dbunit.profile";
36 private static final String PROFILE_DRIVER_CLASS = "dbunit.profile.driverClass";
37 private static final String PROFILE_URL = "dbunit.profile.url";
38 private static final String PROFILE_SCHEMA = "dbunit.profile.schema";
39 private static final String PROFILE_USER = "dbunit.profile.user";
40 private static final String PROFILE_PASSWORD = "dbunit.profile.password";
41 private static final String PROFILE_UNSUPPORTED_FEATURES = "dbunit.profile.unsupportedFeatures";
42
43 private final Properties _properties;
44
45 public DatabaseProfile(Properties properties)
46 {
47 _properties = properties;
48
49
50
51
52
53 }
54
55 public String getActiveProfile()
56 {
57 return _properties.getProperty(DATABASE_PROFILE);
58 }
59
60 public String getDriverClass()
61 {
62 return _properties.getProperty(PROFILE_DRIVER_CLASS);
63 }
64
65 public String getConnectionUrl()
66 {
67 return _properties.getProperty(PROFILE_URL);
68 }
69
70 public String getSchema()
71 {
72 return _properties.getProperty(PROFILE_SCHEMA, null);
73 }
74
75 public String getUser()
76 {
77 return _properties.getProperty(PROFILE_USER);
78 }
79
80 public String getPassword()
81 {
82 return _properties.getProperty(PROFILE_PASSWORD);
83 }
84
85 public String[] getUnsupportedFeatures()
86 {
87 String property = _properties.getProperty(PROFILE_UNSUPPORTED_FEATURES);
88
89
90 if(property == null){
91 return EMPTY_ARRAY;
92 }
93
94 List stringList = new ArrayList();
95 StringTokenizer tokenizer = new StringTokenizer(property, ",");
96 while(tokenizer.hasMoreTokens())
97 {
98 stringList.add(tokenizer.nextToken().trim());
99 }
100 return (String[])stringList.toArray(new String[stringList.size()]);
101 }
102
103 }
104
105
106
107
108