001
014
015 package com.liferay.portlet;
016
017 import com.liferay.portal.kernel.lar.PortletDataHandler;
018 import com.liferay.portal.kernel.poller.PollerProcessor;
019 import com.liferay.portal.kernel.pop.MessageListener;
020 import com.liferay.portal.kernel.portlet.ConfigurationAction;
021 import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
022 import com.liferay.portal.kernel.portlet.PortletBag;
023 import com.liferay.portal.kernel.portlet.PortletLayoutListener;
024 import com.liferay.portal.kernel.search.Indexer;
025 import com.liferay.portal.kernel.search.OpenSearch;
026 import com.liferay.portal.kernel.servlet.URLEncoder;
027 import com.liferay.portal.kernel.util.LocaleUtil;
028 import com.liferay.portal.kernel.webdav.WebDAVStorage;
029 import com.liferay.portal.kernel.workflow.WorkflowHandler;
030 import com.liferay.portal.kernel.xmlrpc.Method;
031 import com.liferay.portlet.asset.model.AssetRendererFactory;
032 import com.liferay.portlet.expando.model.CustomAttributesDisplay;
033 import com.liferay.portlet.social.model.SocialActivityInterpreter;
034 import com.liferay.portlet.social.model.SocialRequestInterpreter;
035
036 import java.util.List;
037 import java.util.Locale;
038 import java.util.Map;
039 import java.util.ResourceBundle;
040
041 import javax.portlet.Portlet;
042 import javax.portlet.PreferencesValidator;
043
044 import javax.servlet.ServletContext;
045
046
050 public class PortletBagImpl implements PortletBag {
051
052 public PortletBagImpl(
053 String portletName, ServletContext servletContext,
054 Portlet portletInstance,
055 ConfigurationAction configurationActionInstance,
056 Indexer indexerInstance, OpenSearch openSearchInstance,
057 FriendlyURLMapper friendlyURLMapperInstance,
058 URLEncoder urlEncoderInstance,
059 PortletDataHandler portletDataHandlerInstance,
060 PortletLayoutListener portletLayoutListenerInstance,
061 PollerProcessor pollerProcessorInstance,
062 MessageListener popMessageListenerInstance,
063 SocialActivityInterpreter socialActivityInterpreterInstance,
064 SocialRequestInterpreter socialRequestInterpreterInstance,
065 WebDAVStorage webDAVStorageInstance, Method xmlRpcMethodInstance,
066 ControlPanelEntry controlPanelEntryInstance,
067 List<AssetRendererFactory> assetRendererFactoryInstances,
068 List<CustomAttributesDisplay> customAttributesDisplayInstances,
069 List<WorkflowHandler> workflowHandlerInstances,
070 PreferencesValidator preferencesValidatorInstance,
071 Map<String, ResourceBundle> resourceBundles) {
072
073 _portletName = portletName;
074 _servletContext = servletContext;
075 _portletInstance = portletInstance;
076 _configurationActionInstance = configurationActionInstance;
077 _indexerInstance = indexerInstance;
078 _openSearchInstance = openSearchInstance;
079 _friendlyURLMapperInstance = friendlyURLMapperInstance;
080 _urlEncoderInstance = urlEncoderInstance;
081 _portletDataHandlerInstance = portletDataHandlerInstance;
082 _portletLayoutListenerInstance = portletLayoutListenerInstance;
083 _pollerProcessorInstance = pollerProcessorInstance;
084 _popMessageListenerInstance = popMessageListenerInstance;
085 _socialActivityInterpreterInstance = socialActivityInterpreterInstance;
086 _socialRequestInterpreterInstance = socialRequestInterpreterInstance;
087 _webDAVStorageInstance = webDAVStorageInstance;
088 _xmlRpcMethodInstance = xmlRpcMethodInstance;
089 _controlPanelEntryInstance = controlPanelEntryInstance;
090 _assetRendererFactoryInstances = assetRendererFactoryInstances;
091 _customAttributesDisplayInstances = customAttributesDisplayInstances;
092 _workflowHandlerInstances = workflowHandlerInstances;
093 _preferencesValidatorInstance = preferencesValidatorInstance;
094 _resourceBundles = resourceBundles;
095 }
096
097 public Object clone() {
098 return new PortletBagImpl(
099 getPortletName(), getServletContext(), getPortletInstance(),
100 getConfigurationActionInstance(), getIndexerInstance(),
101 getOpenSearchInstance(), getFriendlyURLMapperInstance(),
102 getURLEncoderInstance(), getPortletDataHandlerInstance(),
103 getPortletLayoutListenerInstance(), getPollerProcessorInstance(),
104 getPopMessageListenerInstance(),
105 getSocialActivityInterpreterInstance(),
106 getSocialRequestInterpreterInstance(), getWebDAVStorageInstance(),
107 getXmlRpcMethodInstance(), getControlPanelEntryInstance(),
108 getAssetRendererFactoryInstances(),
109 getCustomAttributesDisplayInstances(),
110 getWorkflowHandlerInstances(), getPreferencesValidatorInstance(),
111 getResourceBundles());
112 }
113
114 public List<AssetRendererFactory> getAssetRendererFactoryInstances() {
115 return _assetRendererFactoryInstances;
116 }
117
118 public ConfigurationAction getConfigurationActionInstance() {
119 return _configurationActionInstance;
120 }
121
122 public ControlPanelEntry getControlPanelEntryInstance() {
123 return _controlPanelEntryInstance;
124 }
125
126 public List<CustomAttributesDisplay> getCustomAttributesDisplayInstances() {
127 return _customAttributesDisplayInstances;
128 }
129
130 public FriendlyURLMapper getFriendlyURLMapperInstance() {
131 return _friendlyURLMapperInstance;
132 }
133
134 public Indexer getIndexerInstance() {
135 return _indexerInstance;
136 }
137
138 public OpenSearch getOpenSearchInstance() {
139 return _openSearchInstance;
140 }
141
142 public PollerProcessor getPollerProcessorInstance() {
143 return _pollerProcessorInstance;
144 }
145
146 public MessageListener getPopMessageListenerInstance() {
147 return _popMessageListenerInstance;
148 }
149
150 public PortletDataHandler getPortletDataHandlerInstance() {
151 return _portletDataHandlerInstance;
152 }
153
154 public Portlet getPortletInstance() {
155 return _portletInstance;
156 }
157
158 public PortletLayoutListener getPortletLayoutListenerInstance() {
159 return _portletLayoutListenerInstance;
160 }
161
162 public String getPortletName() {
163 return _portletName;
164 }
165
166 public PreferencesValidator getPreferencesValidatorInstance() {
167 return _preferencesValidatorInstance;
168 }
169
170 public ResourceBundle getResourceBundle(Locale locale) {
171 ResourceBundle resourceBundle = _resourceBundles.get(
172 LocaleUtil.toLanguageId(locale));
173
174 if (resourceBundle == null) {
175 resourceBundle = _resourceBundles.get(locale.getLanguage());
176
177 if (resourceBundle == null) {
178 resourceBundle = _resourceBundles.get(
179 LocaleUtil.toLanguageId(LocaleUtil.getDefault()));
180 }
181 }
182
183 return resourceBundle;
184 }
185
186 public Map<String, ResourceBundle> getResourceBundles() {
187 return _resourceBundles;
188 }
189
190 public ServletContext getServletContext() {
191 return _servletContext;
192 }
193
194 public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
195 return _socialActivityInterpreterInstance;
196 }
197
198 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
199 return _socialRequestInterpreterInstance;
200 }
201
202 public URLEncoder getURLEncoderInstance() {
203 return _urlEncoderInstance;
204 }
205
206 public WebDAVStorage getWebDAVStorageInstance() {
207 return _webDAVStorageInstance;
208 }
209
210 public List<WorkflowHandler> getWorkflowHandlerInstances() {
211 return _workflowHandlerInstances;
212 }
213
214 public Method getXmlRpcMethodInstance() {
215 return _xmlRpcMethodInstance;
216 }
217
218 public void setPortletInstance(Portlet portletInstance) {
219 _portletInstance = portletInstance;
220 }
221
222 public void setPortletName(String portletName) {
223 _portletName = portletName;
224 }
225
226 private List<AssetRendererFactory> _assetRendererFactoryInstances;
227 private ConfigurationAction _configurationActionInstance;
228 private ControlPanelEntry _controlPanelEntryInstance;
229 private List<CustomAttributesDisplay> _customAttributesDisplayInstances;
230 private FriendlyURLMapper _friendlyURLMapperInstance;
231 private Indexer _indexerInstance;
232 private OpenSearch _openSearchInstance;
233 private PollerProcessor _pollerProcessorInstance;
234 private MessageListener _popMessageListenerInstance;
235 private PortletDataHandler _portletDataHandlerInstance;
236 private Portlet _portletInstance;
237 private PortletLayoutListener _portletLayoutListenerInstance;
238 private String _portletName;
239 private PreferencesValidator _preferencesValidatorInstance;
240 private Map<String, ResourceBundle> _resourceBundles;
241 private ServletContext _servletContext;
242 private SocialActivityInterpreter _socialActivityInterpreterInstance;
243 private SocialRequestInterpreter _socialRequestInterpreterInstance;
244 private URLEncoder _urlEncoderInstance;
245 private WebDAVStorage _webDAVStorageInstance;
246 private Method _xmlRpcMethodInstance;
247 private List<WorkflowHandler> _workflowHandlerInstances;
248
249 }