1
22
23 package com.liferay.portlet;
24
25 import com.liferay.portal.kernel.job.Scheduler;
26 import com.liferay.portal.kernel.poller.PollerProcessor;
27 import com.liferay.portal.kernel.pop.MessageListener;
28 import com.liferay.portal.kernel.portlet.ConfigurationAction;
29 import com.liferay.portal.kernel.portlet.FriendlyURLMapper;
30 import com.liferay.portal.kernel.portlet.PortletBag;
31 import com.liferay.portal.kernel.portlet.PortletLayoutListener;
32 import com.liferay.portal.kernel.search.Indexer;
33 import com.liferay.portal.kernel.search.OpenSearch;
34 import com.liferay.portal.kernel.servlet.URLEncoder;
35 import com.liferay.portal.kernel.util.LocaleUtil;
36 import com.liferay.portal.lar.PortletDataHandler;
37 import com.liferay.portal.webdav.WebDAVStorage;
38 import com.liferay.portlet.social.model.SocialActivityInterpreter;
39 import com.liferay.portlet.social.model.SocialRequestInterpreter;
40
41 import java.util.Locale;
42 import java.util.Map;
43 import java.util.ResourceBundle;
44
45 import javax.portlet.Portlet;
46 import javax.portlet.PreferencesValidator;
47
48 import javax.servlet.ServletContext;
49
50
56 public class PortletBagImpl implements PortletBag {
57
58 public PortletBagImpl(
59 String portletName, ServletContext servletContext,
60 Portlet portletInstance,
61 ConfigurationAction configurationActionInstance,
62 Indexer indexerInstance, OpenSearch openSearchInstance,
63 Scheduler schedulerInstance,
64 FriendlyURLMapper friendlyURLMapperInstance,
65 URLEncoder urlEncoderInstance,
66 PortletDataHandler portletDataHandlerInstance,
67 PortletLayoutListener portletLayoutListenerInstance,
68 PollerProcessor pollerProcessorInstance,
69 MessageListener popMessageListenerInstance,
70 SocialActivityInterpreter socialActivityInterpreterInstance,
71 SocialRequestInterpreter socialRequestInterpreterInstance,
72 WebDAVStorage webDAVStorageInstance,
73 ControlPanelEntry controlPanelEntryInstance,
74 PreferencesValidator preferencesValidatorInstance,
75 Map<String, ResourceBundle> resourceBundles) {
76
77 _portletName = portletName;
78 _servletContext = servletContext;
79 _portletInstance = portletInstance;
80 _configurationActionInstance = configurationActionInstance;
81 _indexerInstance = indexerInstance;
82 _openSearchInstance = openSearchInstance;
83 _schedulerInstance = schedulerInstance;
84 _friendlyURLMapperInstance = friendlyURLMapperInstance;
85 _urlEncoderInstance = urlEncoderInstance;
86 _portletDataHandlerInstance = portletDataHandlerInstance;
87 _portletLayoutListenerInstance = portletLayoutListenerInstance;
88 _pollerProcessorInstance = pollerProcessorInstance;
89 _popMessageListenerInstance = popMessageListenerInstance;
90 _socialActivityInterpreterInstance = socialActivityInterpreterInstance;
91 _socialRequestInterpreterInstance = socialRequestInterpreterInstance;
92 _webDAVStorageInstance = webDAVStorageInstance;
93 _controlPanelEntryInstance = controlPanelEntryInstance;
94 _preferencesValidatorInstance = preferencesValidatorInstance;
95 _resourceBundles = resourceBundles;
96 }
97
98 public Object clone() {
99 return new PortletBagImpl(
100 getPortletName(), getServletContext(), getPortletInstance(),
101 getConfigurationActionInstance(), getIndexerInstance(),
102 getOpenSearchInstance(), getSchedulerInstance(),
103 getFriendlyURLMapperInstance(), getURLEncoderInstance(),
104 getPortletDataHandlerInstance(), getPortletLayoutListenerInstance(),
105 getPollerProcessorInstance(), getPopMessageListenerInstance(),
106 getSocialActivityInterpreterInstance(),
107 getSocialRequestInterpreterInstance(), getWebDAVStorageInstance(),
108 getControlPanelEntryInstance(), getPreferencesValidatorInstance(),
109 getResourceBundles());
110 }
111
112 public ConfigurationAction getConfigurationActionInstance() {
113 return _configurationActionInstance;
114 }
115
116 public ControlPanelEntry getControlPanelEntryInstance() {
117 return _controlPanelEntryInstance;
118 }
119
120 public FriendlyURLMapper getFriendlyURLMapperInstance() {
121 return _friendlyURLMapperInstance;
122 }
123
124 public Indexer getIndexerInstance() {
125 return _indexerInstance;
126 }
127
128 public OpenSearch getOpenSearchInstance() {
129 return _openSearchInstance;
130 }
131
132 public PollerProcessor getPollerProcessorInstance() {
133 return _pollerProcessorInstance;
134 }
135
136 public MessageListener getPopMessageListenerInstance() {
137 return _popMessageListenerInstance;
138 }
139
140 public PortletDataHandler getPortletDataHandlerInstance() {
141 return _portletDataHandlerInstance;
142 }
143
144 public Portlet getPortletInstance() {
145 return _portletInstance;
146 }
147
148 public PortletLayoutListener getPortletLayoutListenerInstance() {
149 return _portletLayoutListenerInstance;
150 }
151
152 public String getPortletName() {
153 return _portletName;
154 }
155
156 public PreferencesValidator getPreferencesValidatorInstance() {
157 return _preferencesValidatorInstance;
158 }
159
160 public ResourceBundle getResourceBundle(Locale locale) {
161 ResourceBundle resourceBundle = _resourceBundles.get(
162 LocaleUtil.toLanguageId(locale));
163
164 if (resourceBundle == null) {
165 resourceBundle = _resourceBundles.get(locale.getLanguage());
166
167 if (resourceBundle == null) {
168 resourceBundle = _resourceBundles.get(
169 LocaleUtil.toLanguageId(LocaleUtil.getDefault()));
170 }
171 }
172
173 return resourceBundle;
174 }
175
176 public Map<String, ResourceBundle> getResourceBundles() {
177 return _resourceBundles;
178 }
179
180 public Scheduler getSchedulerInstance() {
181 return _schedulerInstance;
182 }
183
184 public ServletContext getServletContext() {
185 return _servletContext;
186 }
187
188 public SocialActivityInterpreter getSocialActivityInterpreterInstance() {
189 return _socialActivityInterpreterInstance;
190 }
191
192 public SocialRequestInterpreter getSocialRequestInterpreterInstance() {
193 return _socialRequestInterpreterInstance;
194 }
195
196 public URLEncoder getURLEncoderInstance() {
197 return _urlEncoderInstance;
198 }
199
200 public WebDAVStorage getWebDAVStorageInstance() {
201 return _webDAVStorageInstance;
202 }
203
204 public void setPortletInstance(Portlet portletInstance) {
205 _portletInstance = portletInstance;
206 }
207
208 public void setPortletName(String portletName) {
209 _portletName = portletName;
210 }
211
212 private ConfigurationAction _configurationActionInstance;
213 private ControlPanelEntry _controlPanelEntryInstance;
214 private FriendlyURLMapper _friendlyURLMapperInstance;
215 private Indexer _indexerInstance;
216 private OpenSearch _openSearchInstance;
217 private PollerProcessor _pollerProcessorInstance;
218 private MessageListener _popMessageListenerInstance;
219 private PortletDataHandler _portletDataHandlerInstance;
220 private Portlet _portletInstance;
221 private PortletLayoutListener _portletLayoutListenerInstance;
222 private String _portletName;
223 private PreferencesValidator _preferencesValidatorInstance;
224 private Map<String, ResourceBundle> _resourceBundles;
225 private Scheduler _schedulerInstance;
226 private ServletContext _servletContext;
227 private SocialActivityInterpreter _socialActivityInterpreterInstance;
228 private SocialRequestInterpreter _socialRequestInterpreterInstance;
229 private URLEncoder _urlEncoderInstance;
230 private WebDAVStorage _webDAVStorageInstance;
231
232 }