001: /*
002: * Copyright 2002 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: */
013:
014: package com.sun.portal.container.impl;
015:
016: import com.sun.portal.container.ContainerRequest;
017: import com.sun.portal.container.ChannelMode;
018: import com.sun.portal.container.WindowState;
019: import com.sun.portal.container.ChannelURLFactory;
020:
021: import javax.servlet.http.HttpServletRequest;
022:
023: import java.util.List;
024: import java.util.Map;
025:
026: /**
027: * A <code>ContainerRequest</code> encapsulates the request sent by the
028: * aggregation engine to the container.
029: **/
030: public class ContainerRequestImpl implements ContainerRequest {
031:
032: private HttpServletRequest _req = null;
033: private WindowState _windowState = WindowState.NORMAL;
034: private ChannelMode _channelMode = ChannelMode.VIEW;
035: private WindowState _previousWindowState = null;
036: private ChannelMode _previousChannelMode = null;
037: private String _entityID = null;
038: private String _userID = null;
039: private List _roles = null;
040: private List _allowableWindowState = null;
041: private List _allowableChannelMode = null;
042: private List _allowableContentType = null;
043: private Map _userInfo = null;
044: private ChannelURLFactory _channelURLFactory = null;
045: private String _charEncoding = null;
046: private boolean _isReadOnly = false;
047:
048: /**
049: * Returns the HttpServletRequest.
050: *
051: * @return the HttpServletRequest
052: **/
053: public HttpServletRequest getHttpServletRequest() {
054: return _req;
055: }
056:
057: /**
058: * Sets the HttpServletRequest.
059: *
060: * @param request the HttpServletRequest to be set to
061: */
062: public void setHttpServletRequest(HttpServletRequest req) {
063: _req = req;
064: }
065:
066: /**
067: * Returns the current window state of the channel.
068: *
069: * @return current window state
070: **/
071: public WindowState getWindowState() {
072: return _windowState;
073: }
074:
075: /**
076: * Sets the current window state of the channel.
077: *
078: * @param windowState the window state to be set to
079: */
080: public void setWindowState(WindowState windowState) {
081: _windowState = windowState;
082: }
083:
084: /**
085: * Returns the current mode of the channel.
086: *
087: * @return the current channel mode
088: **/
089: public ChannelMode getChannelMode() {
090: return _channelMode;
091: }
092:
093: /**
094: * Sets the current mode of the channel.
095: *
096: * @param channel mode the channel mode to be set to
097: */
098: public void setChannelMode(ChannelMode channelMode) {
099: _channelMode = channelMode;
100: }
101:
102: /**
103: * Returns the entityID of the channel that this request is directed to.
104: *
105: * @return the entity ID
106: **/
107: public String getEntityID() {
108: return _entityID;
109: }
110:
111: /**
112: * Sets the entityID of the channel that this request is directed to.
113: *
114: * @param entityID the entity ID to be set to
115: */
116: public void setEntityID(String entityID) {
117: _entityID = entityID;
118: }
119:
120: /**
121: * Returns the ID of the current user.
122: *
123: * @return the userID
124: **/
125: public String getUserID() {
126: return _userID;
127: }
128:
129: /**
130: * Sets the ID of the current user.
131: *
132: * @param userID the ID of the user
133: */
134: public void setUserID(String userID) {
135: _userID = userID;
136: }
137:
138: /**
139: * Returns an <code>List</code> of all the
140: * roles of the current user. Each value in the list is a String
141: * representation of a role value.
142: *
143: * @return the roles of the current user
144: **/
145: public List getRoles() {
146: return _roles;
147: }
148:
149: /**
150: * Sets a role <code>List</code> of all the
151: * roles of the current user. Each value in the list is a String
152: * representation of a role value.
153: *
154: * @param roles the roles of the current user
155: */
156: public void setRoles(List roles) {
157: _roles = roles;
158: }
159:
160: /**
161: * Returns an <code>List</code> of all the
162: * allowable window states for the current channel to be changed to in
163: * this user request. Each value in the list is a <code>WindowState
164: * </code> object.
165: *
166: * @return the allowable window states
167: **/
168: public List getAllowableWindowState() {
169: return _allowableWindowState;
170: }
171:
172: /**
173: * Sets a window states <code>List</code> of all
174: * the allowable window states for the current channel to be changed to in
175: * this user request. Each value in the list is a <code>WindowState
176: * </code> object.
177: *
178: * @param allowableWindowState all the allowable window state
179: **/
180: public void setAllowableWindowState(List allowableWindowState) {
181: _allowableWindowState = allowableWindowState;
182: }
183:
184: /**
185: * Returns an <code>List</code> of all the
186: * allowable channel modes for the current channel to be changed to in
187: * this user request. Each value in the list is a <code>ChannelMode
188: * </code> object.
189: *
190: * @return the allowable channel modes
191: **/
192: public List getAllowableChannelMode() {
193: return _allowableChannelMode;
194: }
195:
196: /**
197: * Sets a channel mode <code>List</code> of all
198: * the allowable channel modes for the current channel to be changed to in
199: * this user request. Each value in the list is a <code>ChannelMode
200: * </code> object.
201: *
202: * @param allowableChannelMode all the allowable channel mode
203: **/
204: public void setAllowableChannelMode(List allowableChannelMode) {
205: _allowableChannelMode = allowableChannelMode;
206: }
207:
208: /**
209: * Returns an <code>List</code> of all the
210: * allowable content type for the current channel.
211: *
212: * @return the allowable content types
213: **/
214: public List getAllowableContentType() {
215: return _allowableContentType;
216: }
217:
218: /**
219: * Sets a content type <code>List</code> of all
220: * the allowable content type for the current channel.
221: *
222: * @param allowableContentType all the allowable content type
223: **/
224: public void setAllowableContentType(List allowableContentType) {
225: _allowableContentType = allowableContentType;
226: }
227:
228: /**
229: * Returns a <code>Map</code> of user related information.
230: *
231: * @return the UserInfo map
232: **/
233: public Map getUserInfo() {
234: return _userInfo;
235: }
236:
237: /**
238: * Set the UserInfo map.
239: *
240: * @param userInfo the map that holds the user related information
241: **/
242: public void setUserInfo(Map userInfo) {
243: _userInfo = userInfo;
244: }
245:
246: /*
247: * Returns the previous channel mode
248: */
249: public ChannelMode getPreviousChannelMode() {
250: return _previousChannelMode;
251: }
252:
253: /*
254: * Sets the previous channel mode
255: */
256: public void setPreviousChannelMode(ChannelMode channelMode) {
257: _previousChannelMode = channelMode;
258: }
259:
260: /**
261: * Returns the previous window state of the channel.
262: *
263: * @return current window state
264: **/
265: public WindowState getPreviousWindowState() {
266: return _previousWindowState;
267: }
268:
269: /**
270: * Sets the previous window state of the channel.
271: *
272: * @param windowState the window state to be set to
273: */
274: public void setPreviousWindowState(WindowState windowState) {
275: _previousWindowState = windowState;
276: }
277:
278: /**
279: * Returns the ChannelURLFactory impl used by the client
280: *
281: * @return ChannelURLFactory
282: **/
283: public ChannelURLFactory getChannelURLFactory() {
284: return _channelURLFactory;
285: }
286:
287: /**
288: * Sets the ChannelURLFactory
289: *
290: * @param channelURLFactory the ChannelURLFactory impl to be used.
291: */
292: public void setChannelURLFactory(ChannelURLFactory channelURLFactory) {
293: _channelURLFactory = channelURLFactory;
294: }
295:
296: /**
297: * Sets the character encoding of the current request.
298: *
299: * @param charEncoding the character encoding of the request
300: */
301: public void setCharacterEncoding(String charEncoding) {
302: _charEncoding = charEncoding;
303: }
304:
305: /**
306: * Returns the character encoding of the current request.
307: *
308: * @return the character encoding
309: **/
310: public String getCharacterEncoding() {
311: return _charEncoding;
312: }
313:
314: /**
315: * Sets whether change in persistent is allowed in the request.
316: *
317: * @param isReadOnly whether this request should be read only
318: */
319: public void setIsReadOnly(boolean isReadOnly) {
320: _isReadOnly = isReadOnly;
321: }
322:
323: /**
324: * Returns whether change in persistent is allowed in the request.
325: *
326: * @return whether this request should be read only
327: **/
328: public boolean getIsReadOnly() {
329: return _isReadOnly;
330: }
331:
332: }
|