001
014
015 package com.liferay.portal.kernel.util;
016
017 import com.liferay.portal.kernel.configuration.Filter;
018 import com.liferay.portal.kernel.log.Log;
019 import com.liferay.portal.kernel.log.LogFactoryUtil;
020
021 import java.util.Properties;
022
023
026 public class PropsUtil {
027
028 public static String get(String key) {
029 String value = null;
030
031 try {
032 Object returnObj = PortalClassInvoker.invoke(
033 _CLASS, _METHOD_GET, key, false);
034
035 if (returnObj != null) {
036 value = (String)returnObj;
037 }
038 }
039 catch (Exception e) {
040 _log.error(e, e);
041 }
042
043 return value;
044 }
045
046 public static String get(String key, Filter filter) {
047 String value = null;
048
049 try {
050 Object returnObj = PortalClassInvoker.invoke(
051 _CLASS, _METHOD_GET, key, filter, false);
052
053 if (returnObj != null) {
054 value = (String)returnObj;
055 }
056 }
057 catch (Exception e) {
058 _log.error(e, e);
059 }
060
061 return value;
062 }
063
064 public static String[] getArray(String key) {
065 String[] value = null;
066
067 try {
068 Object returnObj = PortalClassInvoker.invoke(
069 _CLASS, _METHOD_GET_ARRAY, key, false);
070
071 if (returnObj != null) {
072 value = (String[])returnObj;
073 }
074 }
075 catch (Exception e) {
076 _log.error(e, e);
077 }
078
079 return value;
080 }
081
082 public static Properties getProperties() {
083 Properties properties = null;
084
085 try {
086 Object returnObj = PortalClassInvoker.invoke(
087 _CLASS, _METHOD_GET_PROPERTIES, false);
088
089 if (returnObj != null) {
090 properties = (Properties)returnObj;
091 }
092 }
093 catch (Exception e) {
094 _log.error(e, e);
095 }
096
097 return properties;
098 }
099
100 public static Properties getProperties(
101 String prefix, boolean removePrefix) {
102
103 Properties properties = null;
104
105 try {
106 Object returnObj = PortalClassInvoker.invoke(
107 _CLASS, _METHOD_GET_PROPERTIES, prefix,
108 new BooleanWrapper(removePrefix), false);
109
110 if (returnObj != null) {
111 properties = (Properties)returnObj;
112 }
113 }
114 catch (Exception e) {
115 _log.error(e, e);
116 }
117
118 return properties;
119 }
120
121 private static final String _CLASS = "com.liferay.portal.util.PropsUtil";
122
123 private static final String _METHOD_GET = "get";
124
125 private static final String _METHOD_GET_ARRAY = "getArray";
126
127 private static final String _METHOD_GET_PROPERTIES = "getProperties";
128
129 private static Log _log = LogFactoryUtil.getLog(PropsUtil.class);
130
131 }