1
14
15 package com.liferay.portal.kernel.util;
16
17 import com.liferay.portal.kernel.configuration.Filter;
18 import com.liferay.portal.kernel.log.Log;
19 import com.liferay.portal.kernel.log.LogFactoryUtil;
20
21 import java.util.Properties;
22
23
28 public class PropsUtil {
29
30 public static String get(String key) {
31 String value = null;
32
33 try {
34 Object returnObj = PortalClassInvoker.invoke(
35 _CLASS, _METHOD_GET, key, false);
36
37 if (returnObj != null) {
38 value = (String)returnObj;
39 }
40 }
41 catch (Exception e) {
42 _log.error(e, e);
43 }
44
45 return value;
46 }
47
48 public static String get(String key, Filter filter) {
49 String value = null;
50
51 try {
52 Object returnObj = PortalClassInvoker.invoke(
53 _CLASS, _METHOD_GET, key, filter, false);
54
55 if (returnObj != null) {
56 value = (String)returnObj;
57 }
58 }
59 catch (Exception e) {
60 _log.error(e, e);
61 }
62
63 return value;
64 }
65
66 public static String[] getArray(String key) {
67 String[] value = null;
68
69 try {
70 Object returnObj = PortalClassInvoker.invoke(
71 _CLASS, _METHOD_GET_ARRAY, key, false);
72
73 if (returnObj != null) {
74 value = (String[])returnObj;
75 }
76 }
77 catch (Exception e) {
78 _log.error(e, e);
79 }
80
81 return value;
82 }
83
84 public static Properties getProperties() {
85 Properties properties = null;
86
87 try {
88 Object returnObj = PortalClassInvoker.invoke(
89 _CLASS, _METHOD_GET_PROPERTIES, false);
90
91 if (returnObj != null) {
92 properties = (Properties)returnObj;
93 }
94 }
95 catch (Exception e) {
96 _log.error(e, e);
97 }
98
99 return properties;
100 }
101
102 public static Properties getProperties(
103 String prefix, boolean removePrefix) {
104
105 Properties properties = null;
106
107 try {
108 Object returnObj = PortalClassInvoker.invoke(
109 _CLASS, _METHOD_GET_PROPERTIES, prefix,
110 new BooleanWrapper(removePrefix), false);
111
112 if (returnObj != null) {
113 properties = (Properties)returnObj;
114 }
115 }
116 catch (Exception e) {
117 _log.error(e, e);
118 }
119
120 return properties;
121 }
122
123 private static final String _CLASS = "com.liferay.portal.util.PropsUtil";
124
125 private static final String _METHOD_GET = "get";
126
127 private static final String _METHOD_GET_ARRAY = "getArray";
128
129 private static final String _METHOD_GET_PROPERTIES = "getProperties";
130
131 private static Log _log = LogFactoryUtil.getLog(PropsUtil.class);
132
133 }