1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.synchronoss.cpo.jdbc;
22
23 import org.synchronoss.cpo.AbstractDataSourceInfo;
24
25 import java.util.*;
26
27
28
29
30
31 public abstract class AbstractJdbcDataSourceInfo extends AbstractDataSourceInfo {
32
33 private static final String PASSWORD = "password";
34 private static final String PASSWD = "passwd";
35 private static final String PWD = "pwd";
36
37 public AbstractJdbcDataSourceInfo(String dataSourceName) {
38 super(dataSourceName);
39 }
40
41 public AbstractJdbcDataSourceInfo(String className, SortedMap<String, String> properties) {
42 super(BuildDataSourceName(className, properties));
43 }
44
45 public AbstractJdbcDataSourceInfo(String className, Properties properties) {
46 super(BuildDataSourceName(className, properties));
47 }
48
49 private static String BuildDataSourceName(String s, Properties properties) {
50
51
52
53 SortedMap<String, String> map = new TreeMap<>();
54 for (Object key : properties.keySet()){
55 map.put((String)key, properties.getProperty((String)key));
56 }
57 return BuildDataSourceName(s, map);
58 }
59
60 private static String BuildDataSourceName(String s, SortedMap<String, String> map) {
61 StringBuilder dsName = new StringBuilder(s);
62
63 for (Object obj : map.keySet()) {
64 String key = (String)obj;
65
66 if (!PASSWORD.equalsIgnoreCase(key) && !PASSWD.equalsIgnoreCase(key) && !PWD.equalsIgnoreCase(key) ) {
67 dsName.append(key);
68 dsName.append("=");
69 dsName.append(map.get(key));
70 }
71 }
72
73 return dsName.toString();
74 }
75
76 }