01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.taglib.provider;
06:
07: import javax.servlet.jsp.JspException;
08:
09: import com.sun.portal.providers.Provider;
10: import com.sun.portal.desktop.taglib.BaseDesktopTagSupport;
11: import com.sun.portal.desktop.taglib.DesktopTaglibContext;
12: import com.sun.portal.desktop.taglib.DesktopTaglibException;
13:
14: public class ObtainChannelTag extends BaseDesktopTagSupport {
15:
16: private String mProvider;
17:
18: public void setChannel(String provider) {
19: mProvider = provider;
20: }
21:
22: public int doStartTag() throws JspException {
23: if (!isContextVariable(mProvider)) {
24: throw new DesktopTaglibException(
25: DesktopTaglibException.INVALID_PARAMETER, mProvider);
26: }
27: String v = getVariable(mProvider);
28: Provider p = (Provider) pageContext.getAttribute(v);
29: if (p == null) {
30: throw new DesktopTaglibException(
31: DesktopTaglibException.UNDEFINED_PARAMETER,
32: getVariable(mProvider));
33: } else {
34: mdttlContext = new DesktopTaglibContext();
35: mdttlContext.setCurrentProvider(p);
36: saveDesktopTaglibContext();
37: }
38: return EVAL_BODY_INCLUDE;
39: }
40:
41: public int doEndTag() throws JspException {
42: setCurrentProvider(null);
43: saveDesktopTaglibContext();
44: return EVAL_PAGE;
45: }
46: }
|