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 public static void addProperties(Properties properties) {
41 _instance._addProperties(properties);
42 }
43
44 public static boolean contains(String key) {
45 return _instance._contains(key);
46 }
47
48 public static String get(String key) {
49 return _instance._get(key);
50 }
51
52 public static String get(String key, Filter filter) {
53 return _instance._get(key, filter);
54 }
55
56 public static String[] getArray(String key) {
57 return _instance._getArray(key);
58 }
59
60 public static String[] getArray(String key, Filter filter) {
61 return _instance._getArray(key, filter);
62 }
63
64 public static Properties getProperties() {
65 return _instance._getProperties();
66 }
67
68 public static void removeProperties(Properties properties) {
69 _instance._removeProperties(properties);
70 }
71
72 public static void set(String key, String value) {
73 _instance._set(key, value);
74 }
75
76 private PropsUtil() {
77 _configuration = new ConfigurationImpl(
78 PropsUtil.class.getClassLoader(), PropsFiles.PORTAL);
79
80
83 SystemProperties.set(
84 PropsKeys.RESOURCE_REPOSITORIES_ROOT,
85 _get(PropsKeys.RESOURCE_REPOSITORIES_ROOT));
86 }
87
88 private void _addProperties(Properties properties) {
89 _configuration.addProperties(properties);
90 }
91
92 private boolean _contains(String key) {
93 return _configuration.contains(key);
94 }
95
96 private String _get(String key) {
97 return _configuration.get(key);
98 }
99
100 private String _get(String key, Filter filter) {
101 return _configuration.get(key, filter);
102 }
103
104 private String[] _getArray(String key) {
105 return _configuration.getArray(key);
106 }
107
108 private String[] _getArray(String key, Filter filter) {
109 return _configuration.getArray(key, filter);
110 }
111
112 private Properties _getProperties() {
113 return _configuration.getProperties();
114 }
115
116 private void _removeProperties(Properties properties) {
117 _configuration.removeProperties(properties);
118 }
119
120 private void _set(String key, String value) {
121 _configuration.set(key, value);
122 }
123
124 private static PropsUtil _instance = new PropsUtil();
125
126 private Configuration _configuration;
127
128 }