1
22
23 package com.liferay.portal.util;
24
25 import com.liferay.portal.configuration.ConfigurationImpl;
26 import com.liferay.portal.kernel.configuration.Configuration;
27 import com.liferay.portal.kernel.configuration.Filter;
28 import com.liferay.util.SystemProperties;
29
30 import java.util.Properties;
31
32
38 public class PropsUtil {
39
40
43
44 public static void addProperties(Properties properties) {
45 _instance._addProperties(properties);
46 }
47
48 public static boolean contains(String key) {
49 return _instance._contains(key);
50 }
51
52 public static String get(String key) {
53 return _instance._get(key);
54 }
55
56 public static String get(String key, Filter filter) {
57 return _instance._get(key, filter);
58 }
59
60 public static String[] getArray(String key) {
61 return _instance._getArray(key);
62 }
63
64 public static String[] getArray(String key, Filter filter) {
65 return _instance._getArray(key, filter);
66 }
67
68 public static Properties getProperties() {
69 return _instance._getProperties();
70 }
71
72 public static void removeProperties(Properties properties) {
73 _instance._removeProperties(properties);
74 }
75
76 public static void set(String key, String value) {
77 _instance._set(key, value);
78 }
79
80 private PropsUtil() {
81 _configuration = new ConfigurationImpl(
82 PropsUtil.class.getClassLoader(), PropsFiles.PORTAL);
83
84
87 SystemProperties.set(
88 PropsKeys.RESOURCE_REPOSITORIES_ROOT,
89 _get(PropsKeys.RESOURCE_REPOSITORIES_ROOT));
90 }
91
92 private void _addProperties(Properties properties) {
93 _configuration.addProperties(properties);
94 }
95
96 private boolean _contains(String key) {
97 return _configuration.contains(key);
98 }
99
100 private String _get(String key) {
101 return _configuration.get(key);
102 }
103
104 private String _get(String key, Filter filter) {
105 return _configuration.get(key, filter);
106 }
107
108 private String[] _getArray(String key) {
109 return _configuration.getArray(key);
110 }
111
112 private String[] _getArray(String key, Filter filter) {
113 return _configuration.getArray(key, filter);
114 }
115
116 private Properties _getProperties() {
117 return _configuration.getProperties();
118 }
119
120 private void _removeProperties(Properties properties) {
121 _configuration.removeProperties(properties);
122 }
123
124 private void _set(String key, String value) {
125 _configuration.set(key, value);
126 }
127
128 private static PropsUtil _instance = new PropsUtil();
129
130 private Configuration _configuration;
131
132 }