001: /**
002: * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
003: * @version $Id: SportletProperties.java 6418 2008-02-07 14:54:38Z docentt $
004: */package org.gridsphere.portlet.impl;
005:
006: import java.io.IOException;
007: import java.io.InputStream;
008: import java.util.Properties;
009:
010: /**
011: * <code>SportletProperties</code> conatins all the "hidden" variable names
012: * that get transmitted between the portlet container and the portlets to
013: * request a particular portlet lifecycle action.
014: * <p/>
015: * SportletProperties comtains three kinds of attributes
016: * <ul>
017: * <li>Lifecycle atttributes specify the lifecycle method to invoke on a
018: * portlet</li>
019: * <li>Portlet object attributes contain the actual portlet object e.g.
020: * PortletConfig, PortletSettings which must be transferred in the
021: * servlet request.</li>
022: * <li>Portlet event objects</li>
023: * </ul>
024: */
025: public class SportletProperties {
026:
027: protected static Properties props = null;
028:
029: private static SportletProperties instance = new SportletProperties();
030:
031: /**
032: * Determines which lifecycle command to invoke
033: */
034: public static final String PORTLET_LIFECYCLE_METHOD = "org.gridsphere.portlet.portletLifecycleMethod";
035:
036: // Portlet Lifecyle methods
037: /**
038: * Command to load a portlet
039: */
040: public static final String LOAD = "org.gridsphere.portlet.lifecycle.load";
041:
042: /**
043: * Command to perform the init method on a portlet
044: */
045: public static final String INIT = "org.gridsphere.portlet.lifecycle.init";
046:
047: /**
048: * Command to perform the destroy method on a portlet
049: */
050: public static final String DESTROY = "org.gridsphere.portlet.lifecycle.destroy";
051:
052: /**
053: * Command to perform the login method on a portlet
054: */
055: public static final String LOGIN = "gs_login";
056:
057: /**
058: * Command to perform the logout method on a portlet
059: */
060: public static final String LOGOUT = "gs_logout";
061:
062: /**
063: * Command to perform the service method on a portlet
064: */
065: public static final String SERVICE = "org.gridsphere.portlet.lifecycle.service";
066:
067: // Portlet events
068: /**
069: * The variable name of the ActionEvent object
070: */
071: public static final String ACTION_EVENT = "org.gridsphere.event.ActionEvent";
072:
073: /**
074: * The variable name of the RenderEvent object
075: */
076: public static final String RENDER_EVENT = "org.gridsphere.event.RenderEvent";
077:
078: /**
079: * The variable name of the WindowEvent object
080: */
081: public static final String WINDOW_EVENT = "org.gridsphere.event.WindowEvent";
082:
083: /**
084: * Determines which event listener to notify
085: */
086: public static final String PORTLET_ACTION_METHOD = "org.gridsphere.portlet.lifecycle.portletActionMethod";
087:
088: /**
089: * Command to perform the actionPerformed method on a portlet
090: */
091: public static final String ACTION_PERFORMED = "org.gridsphere.portlet.lifecycle.actionPerformed";
092:
093: public static final String INIT_PAGE = "org.gridsphere.layout.INIT_PAGE";
094: /**
095: * Command to perform the doTitle method on a portlet
096: */
097: public static final String DO_TITLE = "org.gridsphere.portlet.lifecycle.doTitle";
098:
099: public static final String COMPONENT_ID = "cid";
100:
101: public static final String COMPONENT_ID_2 = "cid2";
102:
103: public static final String COMPONENT_ID_VAR = "org.gridsphere.layout.COMPONENT_ID_VAR";
104:
105: public static final String COMPONENT_ID_NUM = "org.gridsphere.layout.COMPONENT_ID_NUM";
106:
107: public static final String COMPONENT_LABEL = "org.gridsphere.layout.COMPONENT_LABEL";
108:
109: public static final String LAYOUT_EDIT_MODE = "org.gridsphere.layout.LAYOUT_EDIT_MODE";
110:
111: public static final String LAYOUT_THEME = "org.gridsphere.layout.THEME";
112:
113: public static final String LAYOUT_RENDERKIT = "org.gridsphere.layout.RENDERKIT";
114:
115: public static final String LAYOUT_PAGE_PARAM = "gs_PageLayout";
116:
117: public static final String LAYOUT_PAGE = "org.gridsphere.layout.PAGE";
118:
119: public static final String PORTLET_SETUP_PAGE_INCLUDE = "org.gridsphere.services.core.setup.PAGE_INCLUDE";
120:
121: public static final String PORTLET_SETUP_PAGE_CONTEXT = "org.gridsphere.services.core.setup.PAGE_CONTEXT";
122:
123: public static final String PORTLET_SETUP_TYPE = "org.gridsphere.services.core.setup.TYPE";
124:
125: public static final String PORTLET_SETUP_TYPE_PRE = "org.gridsphere.services.core.setup.TYPE_PRE";
126:
127: public static final String PORTLET_SETUP_TYPE_POST = "org.gridsphere.services.core.setup.TYPE_POST";
128:
129: public static final String PORTLET_SETUP_OPERATION = "org.gridsphere.services.core.setup.OPERATION";
130:
131: public static final String PORTLET_SETUP_TITLE = "org.gridsphere.services.core.setup.TITLE";
132:
133: public static final String PORTLET_SETUP_DESCRIPTION = "org.gridsphere.services.core.setup.DESCRIPTION";
134:
135: public static final String PORTLET_SETUP_MODULE_NUMBER = "org.gridsphere.services.core.setup.MODULE_NUM";
136:
137: public static final String PORTLET_SETUP_NUMBER_OF_MODULES = "org.gridsphere.services.core.setup.NUM_OF_MODULES";
138:
139: public static final String IGNORE_PARSING = "org.gridsphere.portlet.impl.IGNORE_PARSING";
140:
141: // Used for "action component model" in grid portlets currently
142: public static final String GP_COMPONENT_ID = "gpcompid";
143:
144: public static final String DEFAULT_PORTLET_ACTION_VAR = "org.gridsphere.DEFAULT_PORTLET_ACTION_VAR";
145:
146: public static final String DEFAULT_PORTLET_ACTION = "gs_action";
147:
148: public static final String DEFAULT_PORTLET_ACTION_2 = "gs_action2";
149:
150: public static final String IS_ACTION = "gs_isaction";
151:
152: public static final String DEFAULT_PORTLET_RENDER = "gs_render";
153:
154: public static final String DEFAULT_PORTLET_MESSAGE = "message";
155:
156: public static final String PORTLETID = "pid";
157:
158: public static final String ERROR = "org.gridsphere.portlet.error";
159: // Portlet API objects
160:
161: public static final String CLIENT = "org.gridsphere.portletcontainer.Client";
162:
163: public static final String PORTLET_MODE = "gs_mode";
164:
165: public static final String PORTLET_TITLE = "title";
166:
167: public static final String PREVIOUS_MODE = "org.gridsphere.portlet.PreviousMode";
168:
169: public static final String MODEMODIFIER = "org.gridsphere.portlet.ModeModifier";
170:
171: public static final String PORTLET_WINDOW = "gs_state";
172:
173: public static final String PORTLET_WINDOW_ID = "org.gridsphere.layout.WINDOW_ID";
174:
175: public static final String PORTLET_DATA_MANAGER = "org.gridsphere.portletcontainer.PortletDataManager";
176:
177: public static final String PORTLETERROR = "org.gridsphere.portlet.PortletError";
178:
179: public static final String PREFIX = "up";
180:
181: public static final String PORTLET_USER = "org.gridsphere.services.core.user.User";
182:
183: /**
184: * The variable name of the PortletConfig object
185: */
186: public static final String PORTLET_CONFIG = "javax.portlet.config";
187:
188: public static final String PORTAL_CONTEXT = "javax.portlet.context";
189:
190: public static final String PORTLET_MIMETYPES = "javax.portlet.mimetypes";
191:
192: public static final String PORTLET_PREFERENCES = "javax.portlet.preferences";
193:
194: public static final String PORTLET_PREFERENCES_MANAGER = "org.gridsphere.portletcontainer.impl.PortletPreferencesManager";
195:
196: public static final String PORTLET_GROUP = "org.gridsphere.portlet.PortletGroup";
197:
198: public static final String PORTLET_ROLE = "org.gridsphere.portlet.PortletRole";
199:
200: public static final String RENDER_REQUEST = "javax.portlet.request";
201:
202: public static final String RENDER_RESPONSE = "javax.portlet.response";
203:
204: public static final String PORTLETGROUPS = "org.gridsphere.portlet.groups";
205:
206: public static final String LOCALE = "org.gridsphere.portlet.Locale";
207:
208: public static final String PORTLET_SERVLET = "org.gridsphere.portlets.PortletServlet";
209:
210: public static final String FILE_DOWNLOAD_NAME = "org.gridsphere.portletcontainer.FILE_DOWNLOAD_NAME";
211:
212: public static final String FILE_DOWNLOAD_PATH = "org.gridsphere.portletcontainer.FILE_DOWNLOAD_PATH";
213:
214: public static final String FILE_DOWNLOAD_BINARY = "org.gridsphere.portletcontainer.FILE_DOWNLOAD_BINARY";
215:
216: public static final String FILE_DELETE = "org.gridsphere.portletcontainer.FILE_DELETE";
217:
218: public static final String FILE_DOWNLOAD_ERROR = "org.gridsphere.portletcontainer.FILE_DOWNLOAD_ERROR";
219:
220: public static final String PORTAL_PROPERTIES = "org.gridsphere.PORTAL_PROPERTIES";
221:
222: public static final String ALLOWED_MODES = "org.gridsphere.ALLOWED_MODES";
223:
224: public static final String MIME_TYPES = "org.gridsphere.MIME_TYPES";
225:
226: public static final String RESPONSE_COMMITTED = "org.gridsphere.RESPONSE_COMMITTED";
227:
228: public static final String RENDER_PARAM_PREFIX = "rp_";
229:
230: public static final String RENDER_OUTPUT = "org.gridsphere.layout.RENDER_OUTPUT.";
231:
232: public static final String FLOAT_STATE = "org.gridsphere.portlet.FLOAT_STATE";
233:
234: public static final String DISPLAY_MODES = "org.gridsphere.layout.DISPLAY_MODES";
235:
236: public static final String DISPLAY_STATES = "org.gridsphere.layout.DISPLAY_STATES";
237:
238: public static final String SSL_REQUIRED = "javax.portlet.SSL_REQUIRED";
239:
240: public static final String PORTLET_USER_PRINCIPAL = "org.gridsphere.services.core.user.UserPrincipal";
241:
242: public static final String EXTRA_QUERY_INFO = "org.gridsphere.layout.EXTRA_QUERY_INFO";
243:
244: public static final String CONTEXT_PATH = "org.gridsphere.CONTEXT_PATH";
245:
246: public static final String SERVLET_PATH = "org.gridsphere.SERVLET_PATH";
247:
248: public static final String PAGE_BUFFER = "org.gridsphere.PAGE_BUFFER";
249:
250: public static final String USE_AJAX = "org.gridsphere.USE_AJAX";
251:
252: public static final String COMPONENT_NAME = "org.gridsphere.layout.COMP_NAME";
253:
254: public static final String PORTLET_NAME = "org.gridsphere.PORTLET_NAME";
255:
256: public static final String PORTAL_REDIRECT_PATH = "org.gridsphere.PORTAL_REDIRECT_PATH";
257:
258: // Portal Filter events
259: /**
260: * The variable name of the method to be performed on PortalFilters
261: */
262: public static final String PORTAL_FILTER_EVENT = "org.gridsphere.services.core.filter.EVENT";
263:
264: /**
265: * Command to perform the doAfterLogin method on a PortalFilters
266: */
267: public static final String PORTAL_FILTER_EVENT_AFTER_LOGIN = "org.gridsphere.services.core.filter.EVENT_AFTER_LOGIN";
268:
269: private SportletProperties() {
270: if (props == null) {
271: InputStream propsStream = getClass().getResourceAsStream(
272: "/org/gridsphere/portlet/impl/portlet.properties");
273: props = new Properties();
274: try {
275: props.load(propsStream);
276: } catch (IOException e) {
277: System.err.println("Unable to load portlet.properties");
278: e.printStackTrace();
279: }
280: }
281: }
282:
283: public static SportletProperties getInstance() {
284: return instance;
285: }
286:
287: public String getProperty(String key) {
288: if (key == null)
289: throw new IllegalArgumentException(
290: "property key cannot be null!");
291: return props.getProperty(key);
292: }
293:
294: }
|