001: /*
002: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005:
006: package com.sun.portal.harness;
007:
008: import java.util.Hashtable;
009: import java.util.Map;
010: import java.util.HashMap;
011: import java.util.Locale;
012: import java.util.Set;
013:
014: import java.io.File;
015:
016: import javax.servlet.ServletConfig;
017: import javax.servlet.ServletContext;
018:
019: import javax.servlet.http.HttpServletRequest;
020:
021: import com.sun.portal.desktop.context.DesktopAppContext;
022: import com.sun.portal.desktop.context.DPCacheManager;
023: import com.sun.portal.providers.context.ContainerProviderContext;
024: import com.sun.portal.desktop.context.ContextError;
025:
026: import com.sun.portal.desktop.template.ParsedTagArray;
027: import java.util.List;
028:
029: public class HarnessDesktopAppContext implements DesktopAppContext {
030:
031: public void init(ServletContext ctx) {
032: //tmp - Cathy
033: }
034:
035: /** Creates new HarnessDesktopAppContext */
036: HarnessDesktopAppContext(HarnessProviderContext ctx) {
037: m_HCtx = ctx;
038: }
039:
040: public String getClientPath(String clientType) {
041: return m_HCtx.getClientPath();
042: }
043:
044: public String getClientTypeProperty(String clientType, String key) {
045: return m_HCtx.getClientTypeProperty(clientType, key);
046: }
047:
048: public Set getClientTypeProperties(String clientType, String key) {
049: // FIXME
050: return null;
051: }
052:
053: public ParsedTagArray getTemplate(String type, String locale,
054: String app, String provider, String clientFilePath,
055: String file, String baseDir) {
056: return new ParsedTagArray(m_HCtx.getTemplate(baseDir, type,
057: locale, app, clientFilePath, file));
058: }
059:
060: public StringBuffer getTemplate(String type, String locale,
061: String app, String provider, String clientFilePath,
062: String file, Hashtable table, String baseDir) {
063: return m_HCtx.getTemplate(type, locale, app, clientFilePath,
064: file, table, baseDir);
065:
066: }
067:
068: public StringBuffer getTemplate(String type, String locale,
069: String app, String provider, String clientFilePath,
070: String file, Hashtable table, String baseDir,
071: ContainerProviderContext pc) {
072: return m_HCtx.getTemplate(type, locale, app, clientFilePath,
073: file, table, baseDir, pc);
074: }
075:
076: public String getDefaultClientType() {
077: return m_HCtx.getDefaultClientType();
078: }
079:
080: public void setDebugLevel(short level) {
081: m_HCtx.setDebugLevel(level);
082: }
083:
084: public String getPortalId() {
085: return m_HCtx.getPortalId();
086: }
087:
088: public String getInstanceId() {
089: return m_HCtx.getInstanceId();
090: }
091:
092: public String getTemplateBaseDir() {
093: return m_HCtx.getTemplateBaseDir();
094: }
095:
096: public String getSessionReturnURLParamName() {
097: return m_HCtx.getSessionReturnURLParamName();
098: }
099:
100: public void debugMessage(Object o, Throwable t) {
101: m_HCtx.debugMessage(o, t);
102: }
103:
104: public void debugWarning(Object o, Throwable t) {
105: m_HCtx.debugMessage(o, t);
106: }
107:
108: public String getContentType(String clientType) {
109: return m_HCtx.getContentType();
110: }
111:
112: public String getClientType() {
113: return m_HCtx.getClientType();
114: }
115:
116: public String getCharset(String cty, Locale loc) {
117: return m_HCtx.getCharset();
118: }
119:
120: public short getCookieSupport(String clientType) {
121: return m_HCtx.getCookieSupport();
122: }
123:
124: public short getAuthlessState(String clientType) {
125: return m_HCtx.getAuthlessState();
126: }
127:
128: public String getEncoderClassName(String clientType) {
129: return m_HCtx.getEncoderClassName();
130: }
131:
132: public boolean isDebugMessageEnabled() {
133: return m_HCtx.isDebugMessageEnabled();
134: }
135:
136: public StringBuffer getRequestServer(HttpServletRequest req) {
137: StringBuffer buf = new StringBuffer();
138: buf.append(req.getRequestURI());
139: return buf;
140: }
141:
142: public String getDesktopURL(HttpServletRequest req) {
143: return m_HCtx.getDesktopURL(req);
144: }
145:
146: public String getDesktopURL(HttpServletRequest req, Map map) {
147: // FIXME
148: return m_HCtx.getDesktopURL(req);
149: }
150:
151: public String getDesktopURL(HttpServletRequest req, Map m1, Map m2) {
152: // FIXME
153: return m_HCtx.getDesktopURL(req);
154: }
155:
156: public String getDesktopURL(HttpServletRequest req, String str) {
157: // FIXME
158: return m_HCtx.getDesktopURL(req);
159: }
160:
161: public void debugWarning(Object o) {
162: m_HCtx.debugWarning(o);
163: }
164:
165: public boolean isDebugErrorEnabled() {
166: return m_HCtx.isDebugErrorEnabled();
167: }
168:
169: public void debugMessage(Object o) {
170: m_HCtx.debugMessage(o);
171: }
172:
173: public void debugTrace(Object o) {
174: m_HCtx.debugMessage(o);
175: }
176:
177: public boolean validateSession(HttpServletRequest req) {
178: return true;
179: }
180:
181: public boolean validateAuthlessSession(HttpServletRequest req) {
182: return true;
183: }
184:
185: public File getTemplatePath(String type, String locale, String app,
186: String provider, String clientFilePath, String file,
187: String baseDir) {
188: return m_HCtx.getTemplatePath(type, locale, app,
189: clientFilePath, file, baseDir);
190: }
191:
192: public File getTemplateMostSpecificPath(String type, String locale,
193: String app, String provider, String clientFilePath,
194: String file, String baseDir) {
195: return m_HCtx.getTemplatePath(type, locale, app,
196: clientFilePath, file, baseDir);
197: }
198:
199: public int getTemplateScanInterval() {
200: return m_HCtx.getTemplateScanInterval();
201: }
202:
203: public String getJSPCompilerWARClassPath() {
204: return m_HCtx.getJSPCompilerWARClassPath();
205: }
206:
207: public boolean isDebugEnabled() {
208: return m_HCtx.isDebugEnabled();
209: }
210:
211: public String getClientType(HttpServletRequest req) {
212: return m_HCtx.getClientType();
213: }
214:
215: public short getDebugLevel() {
216: return m_HCtx.getDebugLevel();
217: }
218:
219: public File[] getTemplatePaths(String type, String locale,
220: String app, String provider, String clientFilePath,
221: String file) {
222: return m_HCtx.getTemplatePaths(type, locale, app,
223: clientFilePath, file);
224: }
225:
226: public String getDesktopContextClassName() {
227: return "com.sun.portal.harness.HarnessDesktopContext";
228: }
229:
230: public String getServiceContextClassName() {
231: return "com.sun.portal.desktop.context.PropertiesServiceContext";
232: }
233:
234: public String getSessionProperty(HttpServletRequest req, String name) {
235: return m_HCtx.getSessionProperty(name).toString();
236: }
237:
238: public String getDefaultDesktopType() {
239: return m_HCtx.getDefaultDesktopType();
240: }
241:
242: public String getJSPScratchDir() {
243: return m_HCtx.getJSPScratchDir();
244: }
245:
246: public void debugError(Object o, Throwable t) {
247: m_HCtx.debugError(o, t);
248: }
249:
250: public void debugError(Object o) {
251: m_HCtx.debugError(o);
252: }
253:
254: public void init(ServletConfig sc) {
255: }
256:
257: public String getStaticContentPath() {
258: return m_HCtx.getStaticContentPath();
259: }
260:
261: public String getEditProviderContainerName() {
262: throw new ContextError(
263: "Unexpected call to getEditProviderContainerName()");
264: }
265:
266: public String getDefaultAuthlessUID() {
267: throw new ContextError(
268: "Unexpected call to getDefaultAuthlessID()");
269: }
270:
271: public long getReapInterval() {
272: throw new ContextError("Unexpected call to getReapInterval()");
273: }
274:
275: public long getInactiveMax() {
276: throw new ContextError("Unexpected call to getInactiveMax()");
277: }
278:
279: public int getCallerPoolMaxSize() {
280: throw new ContextError(
281: "Unexpected call to getCallerPoolMaxSize()");
282: }
283:
284: public int getCallerPoolPartitionSize() {
285: throw new ContextError(
286: "Unexpected call to getCallerPartitionSize()");
287: }
288:
289: public int getCallerPoolMinSize() {
290: throw new ContextError(
291: "Unexpected call to getCallerPoolMinSize()");
292: }
293:
294: public int getGetterPoolMaxSize() {
295: throw new ContextError(
296: "Unexpected call to getGetterPoolMaxSize()");
297: }
298:
299: public int getGetterPoolPartitionSize() {
300: throw new ContextError(
301: "Unexpected call to getGetterPartitionSize()");
302: }
303:
304: public int getGetterPoolMinSize() {
305: throw new ContextError(
306: "Unexpected call to getGetterPoolMinSize()");
307: }
308:
309: public String getCookiePrefix() {
310: throw new ContextError("Unexpected call to getCookiePrefix()");
311: }
312:
313: public String getLBCookieName() {
314: return null;
315: }
316:
317: public String getConfigProperty(String key) {
318: return m_HCtx.getConfigProperty(key);
319: }
320:
321: public long getClientSessionReapInterval() {
322: throw new ContextError(
323: "Unexpected call to getClientSessionReapInterval()");
324: }
325:
326: public long getClientSessionInactiveMax() {
327: throw new ContextError(
328: "Unexpected call to getClientSessionInactiveMax()");
329: }
330:
331: public long getClientSessionsMax() {
332: throw new ContextError(
333: "Unexpected call to getClientSessionMax()");
334: }
335:
336: public int getClassLoaderRevalidateInterval() {
337: throw new ContextError(
338: "Unexpected call to getClassLoaderRevalidateInterval()");
339: }
340:
341: public int getBrowserCacheInterval() {
342: throw new ContextError(
343: "Unexpected call to getClassBrowserCacheInterval()");
344: }
345:
346: public int getDPScanInterval() {
347: return DPCacheManager.DP_SCAN_INTERVAL_ALWAYS;
348: }
349:
350: public List getCurrentCommunityContributorTypes() {
351: throw new ContextError(
352: "Unexpected call to getCurrentCommunityContributorTypes()");
353: }
354:
355: public void logWarning(Object o, Throwable t) {
356: m_HCtx.logWarning(o, t);
357: }
358:
359: /*
360: public String getSystemIDPath() {
361: return m_HCtx.getSystemIDPath();
362: }
363: **/
364:
365: public String getSessionID(HttpServletRequest req) {
366: return m_HCtx.getSessionID();
367: }
368:
369: public boolean isDebugWarningEnabled() {
370: return m_HCtx.isDebugWarningEnabled();
371: }
372:
373: /**
374: * Gets the server-specific (global) attribute.
375: * @param name The attribute name.
376: * @return The attribute value in String format. If property is
377: * not not found, return null.
378: */
379: public String getStringAttribute(String name) {
380: return m_HCtx.getStringAttribute(name);
381: }
382:
383: public String getProviderClassBaseDir() {
384: return m_HCtx.getProviderClassBaseDir();
385: }
386:
387: /**
388: * Sets the server-specific (global) attribute value.
389: * New data is persisted immediately.
390: * @param name The attribute name.
391: * @param name The attribute value.
392: */
393: public void setStringAttribute(String name, String val) {
394: m_HCtx.setStringAttribute(name, val);
395: }
396:
397: public String getNoSessionURL() {
398: return m_HCtx.getNoSessionURL();
399: }
400:
401: public boolean isAuthorizedAuthlessUID(String uid) {
402: return false;
403: }
404:
405: public boolean isAuthlessEnabled() {
406: return false;
407: }
408:
409: public Map getAuthorizedAuthlessUIDs() {
410: return new HashMap();
411: }
412:
413: public boolean isAuthless(HttpServletRequest req) {
414: return false;
415: }
416:
417: public boolean isWSRP(HttpServletRequest req) {
418: return false; //tmp - Cathy
419: }
420:
421: public boolean isFederationEnabled() {
422: return false;
423: }
424:
425: public String getPreLoginURL(String returnURL,
426: String libertySSOFailedParamName) {
427: return "http://PRELOGIN";
428: }
429:
430: //This method is provided for compilation purposes
431: public int getMaxEventGenerations() {
432: return 1;
433: }
434:
435: //Provided for compilation only ...
436: public String getPortletRenderModeParallel() {
437: return "true";
438: }
439:
440: private HarnessProviderContext m_HCtx;
441: }
|