KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > jsp > taglib > InfoTag


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.bridge.jsp.taglib;
11 import org.mmbase.bridge.jsp.taglib.util.Attribute;
12 import javax.servlet.jsp.JspTagException JavaDoc;
13 import javax.servlet.jsp.JspException JavaDoc;
14
15 /**
16  * Calls 'doInfo' from NodeManager or from Module.
17  *
18  * @author Michiel Meeuwissen
19  * @version $Id: InfoTag.java,v 1.26 2006/06/23 11:32:21 michiel Exp $
20  * @deprecated
21  */

22
23 public class InfoTag extends CloudReferrerTag implements Writer {
24
25     private Attribute nodeManager = Attribute.NULL;
26     private Attribute module = Attribute.NULL;
27     private Attribute command = Attribute.NULL;
28
29     public void setNodemanager(String JavaDoc nm) throws JspTagException JavaDoc {
30         nodeManager = getAttribute(nm);
31     }
32     public void setModule(String JavaDoc m) throws JspTagException JavaDoc {
33         module = getAttribute(m);
34     }
35     public void setCommand(String JavaDoc c) throws JspTagException JavaDoc {
36         command = getAttribute(c);
37     }
38
39     public int doStartTag() throws JspTagException JavaDoc {
40         String JavaDoc result;
41         if (nodeManager != Attribute.NULL) {
42             if (module != Attribute.NULL) {
43                 throw new JspTagException JavaDoc("Cannot give both module and nodemanager");
44             }
45             result = getCloudVar().getNodeManager(nodeManager.getString(this)).getInfo(command.getString(this),
46                                                                                     pageContext.getRequest(),
47                                                                                     pageContext.getResponse());
48         } else if (module != Attribute.NULL) {
49             result = getCloudContext().getModule(module.getString(this)).getInfo(command.getString(this),
50                                                                                  pageContext.getRequest(),
51                                                                                  pageContext.getResponse());
52         } else {
53             throw new JspTagException JavaDoc("Must give module or nodemanager");
54         }
55
56         
57         helper.setValue(result);
58         if (getId() != null) {
59             getContextProvider().getContextContainer().register(getId(), helper.getValue());
60         }
61         return EVAL_BODY_BUFFERED;
62     }
63
64
65     public int doAfterBody() throws JspException JavaDoc {
66         return helper.doAfterBody();
67     }
68
69
70     /**
71     *
72     **/

73     public int doEndTag() throws JspTagException JavaDoc {
74         helper.doEndTag();
75         return super.doEndTag();
76
77     }
78
79 }
80
Popular Tags